App lab : *Extremely slow* pixel plotting


I’ve been using to teach my nephew coding and to show him various fractal algorithms. The problem is that’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?




The code can be found here ( It’s published ) :