Played around with the Mandelbrot example last night.
Here’s a faster version with some minor changes:
https://gist.github.com/288c44efa63465970a1b
What’s changed:
-
local variables are much faster in Lua than global - so it pays to declare your inner loop vars as local; this led to a 15% improvement of the initial zoom, and higher when you zoom in (and the iterations of the inner loop go up)
-
instead of updating a single row from the image and drawing all of it, switch the backingMode to RETAINED, use a image consisting of a single row and draw only this image at the appropriate position on the screen. This led to a 2x improvement of the initial zoom.