[Haskell-cafe] Gloss and relatively expensive computations

Daniel Díaz Casanueva dhelta.diaz at gmail.com
Fri Dec 28 01:21:29 CET 2012


Hello cafe!

I'm having some performance issues trying to use gloss to make animations
where each "model" step is relatively time expensive. I'm using the
IO.Simulate module because my step function needs to do an IO operation
which takes around 1 second (it may vary).

I will try to give some details.

I have the step function:

step :: Model -> IO Model
step m = do
 ...
 p <- slowOperation
 ...
 return newModel

The rest of the program is small and simple. The drawing function (Model ->
IO Picture -- it is pure though) is as quick as simple. However, the
program get stuck after the first iteration.

In the other hand, I am using the animateIO function which ask me for an
Int value to set up "the number of simulation steps to take for each second
of real time". But I'm more interested in the animation waiting for the
simulation step to end. Does it make sense?

I would be really thankful with any pointer here.

Thanks in advance,
Daniel Díaz.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121227/a036f830/attachment.htm>


More information about the Haskell-Cafe mailing list