by seanwilson · 7y ago · 0 comments
- Move the "y * width" calculation outside of the "for x" loop.
- The multiply operators can be replaced with addition e.g. replace "y * width" with "counter += width" each y iteration and similarly for the x loop.
Optimising inner loops is really fun.
How much of the speed up in the article is because the JS engine can't figure out how to optimise it compared to the WebAssembly compiler?