Is it possible to vectorize a function in NodeJS the same way it can be done in Python with Pandas?

Viewed 352

To be more specific, I am talking about performing operations over whole rows or columns or matrices instead of scalars, in a (very) efficient way (no need to iterate over the items of the object).

I'm pretty new to NodeJS and I'm coming from Python so sorry if this is something obvious. Are there any equivalent libraries to Pandas in NodeJS that allow to do this?

Thanks

1 Answers

Javascript doesn't give direct access to all SIMD instructions in your computer. Those are the instructions that allow parallel computation on multiple elements of an array.

  • it offers some packages like math.js for clear expression of your algorithms, debugged code, and some optimization work. maht.js's expression of matrices is done with arrays-of-arrays, so it may or may not be the best way to go.
  • it has really good just-in-time compilation.
  • the compilation is friendly to loop unrolling.
  • If you absolutely positively need screamingly fast performance in the Javascript world, there's always WebAssembly: It offers some SIMD instructions. But it takes a lot of tooling.

An attempt to add SIMD to the Javascript standard has been abandoned in favor of WebAssembly.

Related