+ 2
Really slow code, what should I do?
4 odpowiedzi
+ 5
Real improvment here:
https://code.sololearn.com/WP1RBITIPjSO/?ref=app#js
Factorization and asynchronious way explained in code comments ;)
+ 3
Code updated to fix little error (image was generated only on pixel every two, but now, it's fine, all pixels are generated ;P)
... and comments completed
+ 3
New version, adding some interactivity (click for pause/resume and double click for restart) and improving the real time preview by doing it in four passes (inspired by my previous mistake which forgoted one pixel on two ), giving a near that four times quicker preview of whole image (double click can so start another generated image without waiting end of possible running one):
https://code.sololearn.com/W3J5raaJhz0r/#js
[ edit ]
4 times faster will be the ideal, if refreshing display by browser would be instantanly, so in real, the first whole image layer is displayed "only" near few less than 3 times faster ^^ It can be even be improved a few again, by refeshing display only each n lines rather than each lines actually ;P
[ edit 2 ]
Done: improved by refreshing display every 5 lines...
+ 1
you can put loading logo until page load