Microsoft adds multithreading to Node.js for compute-heavy apps

The Napa.js runtime is in development to bring C++-like performance to Node.js

Microsoft’s beta Napa.js runtime is offering multithreaded support for the Node.js server-side JavaScript platform, to provide the flexibility of JavaScript with speedy performance akin to C++’s.

By introducing multithreading to Node.js, the Napa.js runtime can more easily handle computation-intensive tasks, Microsoft said.

Built on the same V8 JavaScript runtime as Node.js, Napa.js can be embedded in a host process without Node.js dependency. It can be installed via NPM by typing npm install napajs.

The Node.js Foundation, which oversees the development of Node.js itself, sees Napa.js as part of the Node.js ecosystem, addressing a use case that complements Node.js by providing a way to run multithreaded JavaScript processes for computationally heavy uses cases.

Napa.js also has:

  • A Node.js-compatible module architecture with support for NPM.
  • An API for object transportation, object-sharing, and asynchronous processing capabilities on JavaScript threads.
  • An API for pluggable logging, metric, and memory allocation.

Microsoft’s Napa.js plans include:

  • Performance improvement through support of a pluggable memory allocator and minimization of garbage collection impact on execution latency.
  • Node compatibility.
  • Installation, including complete support for embedded scenarios.
  • Cooperation between JavaScript threads, including a high-level abstraction workflow across JavaScript threads, which may become a separate package, and allowing pluggable transport.
  • Debugging tool support.