3 ms·
Re: native vs JS. I'd say it depends. For certain implementations, such as operations on large arrays, native implementations can provide performance benefits (
by kgryte 8y ago
Re: native vs JS. I'd say it depends. For certain implementations, such as operations on large arrays, native implementations can provide performance benefits (see https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/base/daxpy/benchmark https://github.com/stdlib-js/stdlib/tree/develop/lib/node_mo...). However, for other implementations, including common mathematical functions, implementing them in pure JavaScript can be more performant when running in Node.js, as you do not need to cross from JS to C/C++ (see https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/hypot/benchmark https://github.com/stdlib-js/stdlib/tree/develop/lib/node_mo...). Lastly, even if functionality is backed by native code, would still need JavaScript fallbacks in order to, e.g., allow for bundling and use in non-Node.js environments.