Really slow code, what should I do? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Jun 2017, 8:18 AM
Prabhakar Dev
Prabhakar Dev - avatar
4 Answers
+ 5
Real improvment here: https://code.sololearn.com/WP1RBITIPjSO/?ref=app#js Factorization and asynchronious way explained in code comments ;)
23rd Jun 2017, 10:04 AM
visph
visph - avatar
+ 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
23rd Jun 2017, 10:24 AM
visph
visph - avatar
+ 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...
23rd Jun 2017, 1:56 PM
visph
visph - avatar
+ 1
you can put loading logo until page load
23rd Jun 2017, 8:52 AM
Elie Douaihy
Elie Douaihy - avatar