Hacker News new | ask | show | jobs
by disgruntledphd2 5168 days ago
Urrgh. This came through on my feed earlier today, and I left a comment on it. While javascript is fast (and can be used for many things), the real issue with using it for stats is the lack of libraries. More specifically, as far as I know it cannot interface with Fortran. That's a death knell for any statistical programming language, as it means no LAPACK, and no-one (sane) is going to rewrite all of those linear algebra libraries. So regardless of how fast it is, its not going to make it as a stats language.

That being said, it does make it easier to develop statistically aware web-apps (a particular interest of mine), so that's definitely good.

9 comments

See: https://github.com/NaturalNode/node-lapack (haven't tested it, just to say that it exists).
One relatively speedy route to getting solid numerics scriptability in JS is to do the heavy lifting in NaCl. An NaCl plugin for node would then let you use the same binaries on both the server and client.
What about using https://github.com/rbranson/node-ffi + clapack?

Not that I know what I'm talking about, I've never used Fortran.

> no-one (sane) is going to rewrite all of those linear algebra libraries

Is it because it would take a long time or because it's inherently hard?

It's easy enough to do a basic implementation, but getting good numerical stability and good performance is hard (and in Javascript, it's pretty much impossible with current implementations). See also the matrix multiplication benchmarks in the post: JS is 60x slower than Matlab, even though it's already using typed arrays. A naive triply nested for loop in C would probably perform similarly to the JS, which is to say a lot slower than something optimized for the characteristics of the processor (number of registers, vectorized floating point and cache sizes mostly, I'm not sure if Matlab is using multiple cores here).
Yes, latest versions of Matlab use multithreading.
There are a lot of them, they're all very picky, detailed inner loops, and they're already written and highly tested and optimized. People rewrite it all the time just to find that their versions are incomplete, slow, and buggy and nobody who wants to use LAPACK has patience for any of those three things.
It does mean that there might be mileage in a native tool wrapping LAPACK et al in v8.
I don't know much about javascript implementations. Is there no foreign-function interface available ? If you can interface with C you can interface with Fortran (with a little extra work).
There is no foreign-function interface, but you could use Emscripten to compile C libraries for it.
So regardless of how fast it is, its not going to make it as a stats language

Why do you assume that JS can never be integrated with LAPACK etc.? That's hardly impossible.

any opinion about F#/Mono which seemingly does have blas/lapack support ?
KickStarter project?