4 ms·
Ah, I'm such an idiot for not thinking of inlining! The problem with writing the loop on the WASM side is that passing the data back and forth between JS and W
by vanderZwan 6y ago
Ah, I'm such an idiot for not thinking of inlining!
The problem with writing the loop on the WASM side is that passing the data back and forth between JS and WASM involves typed arrays and array buffers. That has significant overhead of its own. Still, good suggestion, I should try that with a pixel buffer!
> For what it's worth, (scalar) numerical operations in JS are actually quite close to C. It's not like python.
Indeed, and I am generally very impressed and happy with the performance of JavaScript these days! In my experience it only takes a little bit of effort to hint at the compiler if we're working with doubles or 32 bit integers, and then it goes really fast. In this particular case however we needed 64 bit integer arithmetic, so that's a bit of an edge-case.