Development

Microsoft Preps Alternate JavaScript Engine for Node.js

9 Dec 2015 8:23am, by

Microsoft is preparing a JavaScript engine that could be used with Node.js, one that would provide an alternative to the Google V8 engine that the popular runtime relies on today.

While the Microsoft developers admit that that, thus far, the engine, called Chakra Core, is not yet as fast as V8, it could soon serve as a superior replacement in Internet of Things (IoT) devices running next generation ARM Thumb-2 processors, which V8 does not yet support.

Chakra Core also offers capabilities in restricting power, memory and CPU consumption, which will help Node-based applications run more effectively on resource-constrained IoT devices, according to Arunesh Chandra, Microsoft senior program manager for Chakra Core, who detailed the engine at the Node.js Interactive conference, taking place this week in Portland, Oregon.

Last weekend, Microsoft announced it would release the source code for Chakra Core, early next year. Chakra Core is a version of the Chakra JavaScript engine, used in Microsoft’s browsers, but without the Windows-specific bindings.

 

chakra-componentization

 

When Chakra Core is open sourced, the Chakra team is planning to submit a pull request to the Node maintainers asking for Chakra to be incorporated upstream, which, if accepted, would provide the ability for users to download the code for a Chakra Core-based Node.

Microsoft first showed an interest in bringing Chakra to Node last May, Chandra explained. Chakra was ported to run on ARM processors for the Windows 10 IoT Core, which can be run on devices such as the Raspberry Pi 2 and the MinnowBoard Max. So the development team created a set of shims that could intercept V8 API calls, and reroute them to Chakra, which, in turn, allowed them to create a version of Node to run on ARM Thumb-2 devices.

chakra-pipeline

As a JavaScript runtime for running server-based applications, the open source Node.js is becoming increasingly widely-used. It is currently being downloaded more than 2 million times a month, according to the Node Foundation. However, the core of Node relies on a single JavaScript engine at its core, Google V8.

Microsoft argues that Node and its ecosystem would benefit by offering multiple JavaScript engines.  Google, in the past anyway, has occasionally been obtuse about how and when V8 updates are issued. In the long-run, multiple engines may increase Node performance as well, as multiple parties vie to offer the fastest engine.

Chandra admitted that more work still needs to be done to make Chakra Core fully ready for Node production duties. The debugging capabilities are limited. Performance on Node is not quite on par with V8 and many Node packages that were written for specific V8 calls aren’t compatible.

On the upside, Chakra already offers some unique advantages. It provides a more comprehensive support of JavaScript, supporting most of the ECMAScript 2015 (the basis of JavaScript 2015) and even ECMAScript experimental features such as Async Functions. Chakra also has a set of APIs to control resource use, not currently offered by V8, allowing Chakra to be used in devices with very small footprints.

“The idea [with Chakra Core] is to work with the community and contribute as much as possible to Node.js. We are totally committed to this technology and working in the open,” Chandra said.

Feature Image: Principal Microsoft Chakra developers Gaurav Seth (left) and Arunesh Chandra at Node.js Interactive.

A newsletter digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.