App lab : *Extremely slow* pixel plotting

#1

I’ve been using Code.org to teach my nephew coding and to show him various fractal algorithms. The problem is that Code.org’s scripting language is extremely slow. This isn’t the main problem though : In the App Lab, if I draw a line to the canvas it’s much faster than getting the image data for the canvas and plotting pixels by setting their x, y coordinates and red, green, blue and alpha values. Does anyone know why this is? To draw a pixel in the “fast” version of my code I draw a line whose start and end is the same coordinate. If I use the image data and set pixel values, which is much more accurate and looks better, then it’s much slower. Is there any way to get around this?

Thanks,

jdb2

#2

The code can be found here ( It’s published ) : https://studio.code.org/projects/applab/DSeXjs64NTPy97tIYN7hgpgIz6aPsRwV8Y6ViGMqPRk

jdb2