Culture / Development / Edge / IoT

Microsoft’s JavaScript Engine Comes to Linux, OS X and Node.js

2 Aug 2016 9:46am, by

For the last year, Microsoft has been working to make its Chakra JavaScript engine open source and cross platform. At the recent NodeSummit conference, Amanda Silver and Arunesh Chandra from the Microsoft Chakra team showed an “experimental implementation” of the open source ChakraCore interpreter and runtime on x64 Ubuntu Linux and OS X 10.9+.

They also demonstrated ChakraCore running a version of Node.js.

It’s still early days, Silver told us. “In terms of Linux, we really only have one build supported thus far. We have not yet optimized for performance on those OSes. We started with the client workload of IoT-type scenarios, but we have not yet optimized for server-side scenarios; that’s a work in progress. We’re certainly not at the point that we’re saying this is something that should be broadly applied in production environments.”

Early as it is, the Chakra team wants to show the progress they’re making to keep the community in the loop. Silver also notes that there’s increasing participation from developers outside Microsoft on ChakraCore; “it is increasingly becoming a community web project.”

One feature, in particular, proved popular at NodeSummit; time-travel debugging. “That allows you to create a step back button in the debugger,” Silver explained, “which is a cool capability and also pretty critical if want to see what’s happening in various production and test environments.”

One Node, Multiple Engines

That’s the kind of innovation she believes having multiple VMs available for Node will foster. “The more we have more industry players working on the Node stack and the developer experience for the Node stack, the more innovation you’re going to see.”

The standardization of Node needed to allow multiple VMs also helps with that, she believes. “Ensuring there’s a broad tooling ecosystem that’s helping move the node community and experience forward also depends on there being multiple engines enabled. If you think about things like debugging, that ends up creating hooks into the core VM that runs the JavaScript portion of Node. So part of this is creating a set of diagnostic capabilities and APIs that work across the different core engines.”

Having multiple VMs in Node could help avoid a development monoculture in much the same way having multiple browsers does.

Tom Dale, the creator of the Ember.js Web application framework, and Salesforce developer evangelist Emily Rose both see it as a positive development. “Making Node engine-agnostic unlocks the kind of competition that benefits developers. I’m very excited to see Microsoft tackling this,” Dale tweeted and Rose pointed out that the work goes beyond Chakra.

As Silver puts it, “the goal of the decision last year to have Node be shepherded by the Node Foundation was to improve the reliability and confidence people have in Node, in that there are multiple industry sponsors shepherding Node’s future. In terms of ensuring we can define a common JavaScript interface that works across everywhere JavaScript runs, that does depend on there being multiple sponsors.”

As Node becomes more widely used on servers as well as clients, interest in multiple VMs generally and in ChakraCore specifically is increasing. “Industry partners who are building their own stack or platform based on Node want to be able to have the option of having alternative engines be supported.”

For Microsoft, the original impetus was for the Internet of Things, she explained, and not only because the Google V8 JavaScript engine Node currently relies on isn’t available for Windows running on ARM chips.

“It’s important there’s a minimal JavaScript engine that’s optimized for Windows. When you’re thinking about the lower end devices in IoT, you really only want to have one JavaScript engine on there,” she said.

Ironically, though, bringing Node to Windows IoT mean bringing Chakra to platforms beyond Windows. “For anybody to look at ChakraCore and take it seriously, it needs to be something that’s not just for Windows,” Silver explained. “It needs to be able to work with the tooling ecosystem that already exists around Node.”

Could that include client-side shells like Electron? Although Microsoft isn’t making any announcements on that, Silver compares that to the way Microsoft treats the Cordova framework. “The way we approached it for Windows was to make it so Cordova apps are essentially native apps on Windows, which implies that they use the Chakra engine to execute. The reason to do this is to make sure that the payload for the app is very small and that the runtime is optimized for the windows OS. So it’s very similar to our rationale for [Node and] IoT devices and you can extrapolate out what means for various app frameworks that run on JavaScript on Windows.”

Creating a version of Chakra that can power Node doesn’t mean Microsoft is trying to get developers to stop using V8 with Node, either on Azure or when they’re using Microsoft developer tools like Visual Studio and VS Code.

“With respect to Azure and our tooling experiences, our main focus for those continues to be the Node ecosystem as it exists today, which is based on V8,” Silver reassured developers. “In VS Code, when you build Node apps you’re building against V8 unless you intentionally set it to ChakraCore. We expect many people will continue to use Node against V8. We provide great tooling experiences for that and our commitment is to continue to have the best tooling experiences for Node developers.”

Feature Image: Amanda Silver at NodeSummit.

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.