This article is more than 1 year old

Microsoft requests ChakraCore support in main Node.js repository

Only on Windows for now, but cross-platform is promised

Microsoft has submitted a pull request that enables Node.js to run with the ChakraCore JavaScript engine, as an optional alternative to the Google-developed V8 engine.

Chakra is the JavaScript engine developed for Edge, Microsoft's Windows 10 web browser. In December 2015, the company announced that the key components of Chakra would be open source, and ChakraCore is now on GitHub.

Unlike Edge, ChakraCore runs on Windows 7 SP1 or above. It is currently Windows-only, though a cross-platform implementation is on the roadmap, with the initial goal being support for 64-bit Ubuntu for the interpreter and runtime only (no just-in-time compiler). Microsoft also plans to add full support for ECMAScript 2015, also known as ECMAScript 6.

Microsoft added support for Node.js with Chakra in May 2015, but this requires some Node.js customisation. If its pull request is accepted, developers will be able to use Node.js and ChakraCore on Windows without any adaptation.

It will also put pressure on Node.js module developers to ensure that their modules are compatible with both engines. Currently, Microsoft says that "a small subset of modules are natively bound to V8 APIs and can run into compatibility issues."

Developers who write modules using an API called Native Abstractions for Node.js, which is designed to avoid compatibility issues with different versions of V8, should have no problem running on ChakraCore.

The pull request adds a layer of code which implements "the most essential V8 APIs" and translates them to run on ChakraCore.

Microsoft says that ChakraCore can improve Node.js performance. According to its own benchmarks, Node.js with ChakraCore is slightly faster than with V8, when running on Windows 10.

Why is Microsoft keen to inject its technology into Node.js? The answer is to do with the company's focus on lightweight versions of Windows, suitable either for IoT deployments using Windows 10 IoT Core, or for server applications, perhaps running on the forthcoming Nano Server edition, and/or in a container.

This fits with the trend towards microservices, in which distributed applications are composed of multiple small services. Microsoft has adapted its own .NET platform for these scenarios, in the project called .NET Core, but it makes sense to offer the JavaScript-based Node.js as well, especially for developers who come from outside the Microsoft platform.

The pull request will be controversial. Although running on ChakraCore remains optional, it means that Node.js would take a dependency that in theory could impede development, for example if some feature were added to V8 that ChakraCore could not emulate, and therefore could not be used by Node.js.

The other side of this argument is that making Node.js less dependent on a specific JavaScript engine could have long-term benefits, making it easier to adapt to other engines in future.

If Microsoft's pull request is accepted, it will initially be in an experimental branch of Node.js. Progress to the stable branch would likely follow at a later date.

More about

TIP US OFF

Send us news


Other stories you might like