[Haskell-beginners] profiling a program that writes midi events

Benjamin Edwards edwards.benj at gmail.com
Tue Apr 17 18:38:22 CEST 2012

Consider the criterion package + the modifications you suggested. Criterion
comes with useful functions for ensuring that you evaluate expressions


On 16 April 2012 15:47, Dennis Raddle <dennis.raddle at gmail.com> wrote:

> I want to profile a program, but it's not the usual kind of "run once, it
> completes" program. It computes a bunch of midi events and writes them to a
> MIDI port via the Sound.PortMidi module. It waits between events so that
> each one happens in the proper place in the music. And the program must not
> exit while it is writing events.
> When I run it, it takes about ten seconds until the music starts, so it
> must be doing most of the computation then. But it takes several minutes as
> it plays music.
> How would I profile this kind of program?
> One possibility is to modify it a bit so it computes all the midi events
> but doesn't send them, and just exits. However, I have to make sure it
> actually computes the events all the way (due to language laziness). If I
> don't write the events to PortMidi, then they are never used. I'm not sure
> on how to ensure an expression is completely evaluated if it never used.
> Dennis
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120417/855d0138/attachment.htm>

More information about the Beginners mailing list