I'm surprised by the slowness of animations in a canvas. Here's a simple
stress test:
https://gist.github.com/Metaxal/73897e7bac5332054511

For a 100x100 board it takes 2 seconds to draw 10 random frames (outside
DrRacket of course). I was expecting at least 10x more frames per second.

Is there anything that could speed this up substantially?

Some notes:
- Using bigger cells (say size 10 instead of 2) has only a small impact on
the performance
- Drawing directly to the canvas instead of using an intermediate buffer
doesn't help (it's actually even worse because `refresh` may be called more
than necessary)
- Replacing for* by let loops with additions and no multiplication makes no
difference
- Creating the brushes outside the for loop is much faster (almost 1/3)
than inside
- `draw-point` is quite slower than `draw-rectangle` for some reason
- displaying a random number in the terminal instead of selecting the brush
and drawing the rectangle is twice faster
- I'm on Ubuntu 14.04, racket 6.1.1, 64bits

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to