Hacker News new | past | comments | ask | show | jobs | submit login
Vectorious: BLAS-accelerated linear algebra for TypeScript (github.com/mateogianolio)
51 points by PaulHoule on June 3, 2023 | hide | past | favorite | 14 comments



Can anyone weigh in on the state of the JS / TS ecosystem for linear algebra and matrix operations, and how that stacks up against the Python ecosystem?


There's Python/Julia/R, then below there is 50ft of crap and then there is JS/npm ecosystem for data science. Arguably this is also true for a lot of different languages.

Tried to run a Gaussian mixture model in JS. Topped out at 8 dimensions which it could run in minutes. Any more than that would crash. Python (sklearn) ran 200 dimensions in less than a second.


I am surprised to see Lucidrains in this project, this man never rests.


Hm, isn't NodeJS not suitable for heavyweight CPU tasks ?


Just like Python, but at least has a JIT on the box.


Arguably better async primitives too. Python's main advantage at this point feels like a stronger ecosystem of packages calling into native code (eg numpy et al mostly call optimized C routines). If Typescript adds more of those libraries (like this one), then I could see it gaining a lot of adoption.


I think Bun (which has typescript embedded but written in zig) would be a great place to experiment.

I could see it adding some tensor types that drop into zig code that uses webgpu bindings. And add some operator overloading so you could just add t1 + t2 etc.


> [...], written in TypeScript and accelerated with C++ bindings to BLAS and LAPACK

C++ addons for Node.js are not part of the JavaScript runtime.


But it still blocks event loop ?


Native bindings can use libuv to offboard work to other threads and then re trigger the JS execution when it completes.

This is how a lot of the native node libraries work under the hood to allow parallel IO operations! It’s also an incredibly powerful performance optimisation tool in more complex, scale out NodeJS deployments.


So in theory, if we ported python libraries into JS, the performance could be better than Python ?


Python bindings for native libraries would still be the same, they are the same native libraries, while pure Python code would speed up thanks to JavaScript runtimes having JITs.


At work we do some pretty significant parallelised computation (using Node and Rust) and that has equivalent performance to a relevant python based library.

There are nuances to how data enters and exits the VM runtime which means I couldn’t say with confidence if performance would be better or worse in the general case - but either direction is at least technically viable.


i was thinking about that, seems like a good deal overall with limited overhead.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: