Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by revskill on Saturday June 03, 2023 @02:31AM
(#36174267)
Hm, isn't NodeJS not suitable for heavyweight CPU tasks ?
[ Parent
| on HN ]
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by aastronaut on Saturday June 03, 2023 @03:15AM
(#36174430)
> [...], written in TypeScript and accelerated with C++ bindings to BLAS and LAPACK
C++ addons for Node.js are not part of the JavaScript runtime.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by revskill on Saturday June 03, 2023 @03:27AM
(#36174490)
But it still blocks event loop ?
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by byteofbits on Saturday June 03, 2023 @03:49AM
(#36174593)
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.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by revskill on Saturday June 03, 2023 @03:51AM
(#36174600)
So in theory, if we ported python libraries into JS, the performance could be better than Python ?
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by byteofbits on Saturday June 03, 2023 @04:02AM
(#36174651)
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.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by NickChasanis on Saturday June 03, 2023 @04:21PM
(#36180169)
i was thinking about that, seems like a good deal overall with limited overhead.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by pjmlp on Saturday June 03, 2023 @05:25AM
(#36175057)
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.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by pjmlp on Saturday June 03, 2023 @05:22AM
(#36175042)
Just like Python, but at least has a JIT on the box.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by huac on Saturday June 03, 2023 @09:08AM
(#36176385)
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.
Re:Vectorious: BLAS-accelerated linear algebra for TypeScript
by sroussey on Saturday June 03, 2023 @01:24PM
(#36178579)
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.