Hacker News new | ask | show | jobs
by 14113 4101 days ago
You've exactly proved my point - "future integrations with the GPU/SIMD" - they're not the future - they're now. If you want to leverage them, don't write javascript. Or at least, don't write pure javascript implementations, call down to a C or Fortran implementation - which as I said, are hard enough to tune.

If you do want to write javascript however, why not write something more application based, why does it need to be raw linear algebra? Like an image processing library, or a linear-transforms-for-svg library[0]? Why do you need the raw linear algebra primitives, such as being able to map across elements?

Your snark towards my criticism is also absolutely ridiculous - no offense to the author, I think this is quite cool, but it is in no way "forward thinking". I could link to tens of other javascript linear algebra libraries, so why is this one the best? And more importantly - why should it be shielded from criticism?

[0] I will admit, there is something similar to this, based off this library: https://github.com/mateogianolio/vectorious-plot which slightly detracts from my argument, but also bolsters it - as it proves that this library is only really useful with an application library wrapped around it.

1 comments

It's useful having some code in JavaScript. Even if its not fast enough for some things, having a nicely organised and documented library can be very useful.

Optimizations, using Typed Arrays, could make the code considerably faster. C++ addon code could make it faster still. Intrinsics within that addon code could use SIMD. While this library certainly is a lot slower than the equivalent C or Fortran, it's got potential, and it's not something that I'd dismiss as being pointless because it's a particular thing that's written in JavaScript.

Also, in the browser, language choices are very limited. Another reason why having JavaScript code that does a variety of things (including vector maths) is useful.