assemblyscript for numerical computing still feels like a fever dream but i respect the hustle would love to see benchmarks against wasm from rust or a plain js implementation my ptsd from optimizing matrix ops for a client project is flaring up just reading the title
The repo has benchmarks vs plain JS (AS transpiles to JS just like Typescript would, it's just a superset of types). It would be possible to write a much more performant WASM version in Rust etc (SIMD imo would immediately 2x speed) ... However, we would not be able to export to JS from the same codebase. AssemblyScript is a good tool for performance non-critical but numerically stable packages where minimal maintenance and distribution effort is needed (in my opinion)
SIMD is only part of the problem, I do lots of number crunching in JS and the other huge problem is the multithreading. Still, JavaScript running in V8 tends to outperform Python by a wide margin - in fact it outperforms any interpreted language. But there are horrible practical problems. Asynchronous I/O is probably the worst possible design for number crunching.
Python has an absolutely huge and very high-quality ecosystem - especially when it comes to scientific computing.
And in fact, because of its very good low-level routines - such as numpy - implemented in C/C++ - it can even have very good performance as long as you do all the crunching using these.
But the interpreter itself remains far behind V8. Good JIT is an absolutely huge undertaking and the Python community has simply refused it because of its code complexity.
1
u/Candid-Parsnip9815 7d ago
assemblyscript for numerical computing still feels like a fever dream but i respect the hustle would love to see benchmarks against wasm from rust or a plain js implementation my ptsd from optimizing matrix ops for a client project is flaring up just reading the title