Node.js version 12 is now out: Let's pop the hood and see what's inside this JS runtime

Node.js, the popular JavaScript runtime that relies on the Chrome V8 JavaScript engine, hit version 12 on Tuesday, bringing with a handful of potentially useful features and capabilities.

Per the project's release schedule, in which even numbered releases get designated for Long-Term Support - to give companies technical stability over a predictable period of time - v12 is scheduled to become an LTS release in October 2019.

Node.js 12 inherits the improvements made to the Chrome V8 engine in March, now at v7.4, which mostly have to do with execution speed and reduced memory overhead.

In an email to The Register, Myles Borins, Node.js technical steering committee chairman, pointed out the most significant improvements. V8 v7.4 brings with it async stack traces, which provide more extensive debugging information for Node developers without additional V8 overhead. Node.js 12 also adds TLS 1.3 support, which is more secure than its predecessor.

The refurbished runtime includes a new implementation of ES6 Modules, a more modern way of integrating modules than the legacy CommonJS style. And, Borins observes, it starts up about 30 per cent faster than its predecessor.

Bethany Griggs, Node.js runtime developer at IBM, and Michael Dawson, IBM community lead for Node.js, in a blog post, highlighted the release's improved support for native modules.

"Node.js 12 continues the trend of making building and supporting native modules easier," they said. "Changes include better support for native modules in combination with Worker threads, as well as N-API version 4 which makes it easier to use your own threads for native asynchronous functions."

Griggs and Dawson note that Node 12 switches its default parser for reading HTTP messages written in C from http_parser to llhttp, a TypeScript port of http_parser that's arguably more maintainable.

"llparse is used to generate the output C and/or bitcode artifacts, which could be compiled and linked with the embedder's program (like Node.js)," they explain.

The pair points to another advantage from the V8 engine upgrade. Node.js will now set the JavaScript heap size according to available memory rather than V8 defaults. They say it's a way to ensure Node.js doesn't try to use more memory than is available, which they expect will be helpful for processing large data sets.

And they note that Node.js 12 includes an experimental feature called "Diagnostic report" that lets developers create a report on demand or when triggered by specific events.

Looking ahead to Node.js 13, Borins said some of the strategic initiatives being pursued include Python 3 support, improved startup performance, Core Promise API support, further work on standards and governance, and a new Streams API. ®

Software News

Jul 18
Co-founder and chief data officer at NPM Inc, moves on
Jul 18
'Empowering' if you've got $$$
Jul 18
Redmond engineer hints at taking super-lang for a spin
Jul 18
Software testing just ain't that special, sniff immigration bod
Jul 18
'No safeguards' on QA accounts, and suddenly this guy gets a Tesla and $1.6m home, say prosecutors
Jul 17
Enterprise features including support for hated ancient browser ready to evaluate
Jul 17
A key proposal for Go 1.14 - adding a built-in try keyword - has been declined