Submitting a Pull Request to Node.js with ChakraCore

Windows

Windows
Node.js continues to be a very successful and powerful cross platform technology for building apps that can run on anything from small IoT devices to large scale services that run in the cloud. We believe allowing more Node.js developers to target more platforms is key to its future growth. To do our part in growing the Node.js pie, last year we
Please, Log in or Register to view URLs content!
to extended the reach of Node.js and allowed developers to target a brand new platform called
Please, Log in or Register to view URLs content!
. So far Node.js with Chakra has been actively
Please, Log in or Register to view URLs content!
and iterated upon
Please, Log in or Register to view URLs content!
, with the intention to merge it with the mainline after stabilizing the code.

Today we hit that major milestone on our roadmap by submitting a
Please, Log in or Register to view URLs content!
to enable Node.js to work with
Please, Log in or Register to view URLs content!
.

The recent
Please, Log in or Register to view URLs content!
gives us the opportunity to develop in the open and align better with Node.js release schedules, in addition to expanding our support for Node.js across the broader Windows ecosystem – starting with Windows 7 SP1 and beyond. Here are some important things to know about this pull request.

Support for ChakraCore JS Engine


This pull request enables Node.js to optionally use the ChakraCore JavaScript engine. Chakra Shim, which is a layer on top of the ChakraCore JS Engine, enables building and running Node.js with ChakraCore. This shim implements the most essential V8 APIs so that the underlying JavaScript engine change is transparent to Node.js and other native addon modules written for V8. All that is needed is to rebuild Node.js executable and native addon modules with ChakraCore.

Please, Log in or Register to view URLs content!

Architecture: Extending Node.js with ChakraCore


ChakraCore is a fully capable JavaScript virtual machine that has the same key characteristics that are supported by Chakra. You can learn more about ChakraCore
Please, Log in or Register to view URLs content!
. ChakraCore is independent from Windows 10 and is supported on Windows 7 SP1 and up. We are working on taking ChakraCore cross-platform, starting with Linux, as described at the
Please, Log in or Register to view URLs content!
. ChakraCore also has capabilities to turn off JIT compiler and specify thresholds for resource consumption, both of which significantly reduce the resource requirements and make it attractive for resource constrained hardware scenarios.

State of module compatibility


npm modules are critical to any Node.js project. The vast majority of npm modules are JavaScript-based and should continue to work well with ChakraCore. There is a small subset of modules that are natively bound to V8 APIs and can run into compatibility issues with a different VM or even a different version of V8. This is the reason why
Please, Log in or Register to view URLs content!
(NAN) was born to allow for better module compatibility.

We embraced this abstraction and ensured all NAN based modules are fully supported in Node.js with ChakraCore. We also intend to actively participate in the native module abstraction efforts by contributing our learnings, architectural ideas, prototypes etc. in the community working group. While the abstraction effort is long-term approach, on a shorter term we would love to hear from the community on our
Please, Log in or Register to view URLs content!
if there are any key compatibility gaps still remaining. This will allow us to prioritize the modules that need to be made compatible.

Evaluating Performance


JavaScript engine performance is key to any successful Node.js application or service. It impacts not only the user experience but also impacts cost for compute resources. Historically, the Chakra team has focused on
Please, Log in or Register to view URLs content!
over
Please, Log in or Register to view URLs content!
. To evaluate this, we tested TypeScript compile times, as it represents a large JavaScript program that can give us an indication of underlying JavaScript engine performance in the Node.js environment. The chart below shows various TypeScript workloads, compiled using the TypeScript compiler with Node.js and Node.js with ChakraCore. ChakraCore shows 10% -30% better throughput on these tests.

Please, Log in or Register to view URLs content!

TypeScript compiler performance
(System info: Intel Core i5-34755 @ 2.90Ghz with 4.0GB RAM running Windows 10)


When compared to the baseline of default Node.js performance, Node.js with ChakraCore is more performant than Node.js with Chakra just a few months ago. The following graph plots slower-than-baseline tests below the blue line and the tests that were better than baseline above the blue line. While there’s still work to do, we’re happy that the curve is moving in the right direction.

Please, Log in or Register to view URLs content!

Node.js Benchmark performance
(System info: Intel Core i5-34755 @ 2.90Ghz with 4.0GB RAM running Windows 10)


Our performance testing did identify some differences in the hosting surface that can boost ChakraCore’s performance with Node.js. Continuing to invest in understanding and improving real world performance is a priority for the team. Going forward, we also want to work with the
Please, Log in or Register to view URLs content!
and the community to identify real world performance scenarios for Node.js.

Looking ahead


The team is working on adding two key capabilities around diagnostics support. The first capability is focused on Modern Diagnostic APIs. While developers can use “console.log” style debugging when using Node.js with ChakraCore today, we are building a new set of Modern Diagnostic APIs, which break away from dependencies on COM and will help make the debugging experience of Node.js with ChakraCore interoperable with existing Node.js diagnostic tools. For the second, we are teaming up with Microsoft Research to advance the state of the art of Node.js debugging, with a feature we call
Please, Log in or Register to view URLs content!
.

Taking ChakraCore cross-platform is also high on our roadmap. Node.js is a truly cross-platform technology, and we believe that any JavaScript engine that powers it should be cross-platform as well. We are starting with Linux, and will keep the
Please, Log in or Register to view URLs content!
updated with details and status as we make progress. As a first step towards enabling cross-platform support, we have cleanly separated out Chakra’s JIT compiler producing a build configuration that builds just the interpreter and runtime. This smaller build target is what we will initially enable cross platform. We would love hear what the community thinks about which other platforms we should target. ChakraCore is open for taking contributions and if interested, we invite you to participate in porting ChakraCore to the platform of your choice.

You can participate or follow the work as it progresses on
Please, Log in or Register to view URLs content!
.

Try it out for yourself


You can try Node.js with ChakraCore with your existing scripts using this temporary
Please, Log in or Register to view URLs content!
, which installs Node.js with ChakraCore binaries without having to build it manually from the sources. We plan to work with the
Please, Log in or Register to view URLs content!
to make these binaries available from an official Node.js channel. The current installer installs Node.js with ChakraCore side-by-side with an existing default Node.js installation without disturbing it, so that you can
Please, Log in or Register to view URLs content!
and
Please, Log in or Register to view URLs content!
without disturbing your existing setup.

Our journey with Node.js has just started. We are committed to developing in the open, while working with the Node.js TSCs/CTC and the wider Node.js developer community. We truly see the power of Node.js, admire this community for what it has achieved so far, and we are excited to learn and contribute even more!

We welcome your feedback on our
Please, Log in or Register to view URLs content!
. Try
Please, Log in or Register to view URLs content!
and let us know your
Please, Log in or Register to view URLs content!
. Finally, you can always reach us on Twitter at
Please, Log in or Register to view URLs content!
or visit
Please, Log in or Register to view URLs content!
and leave us a note by opening an
Please, Log in or Register to view URLs content!
or via Gitter. We look forward to hearing from you!

Please, Log in or Register to view URLs content!
, Sr. Program Manager, Chakra

Please, Log in or Register to view URLs content!
, Principal PM Manager, Chakra

Please, Log in or Register to view URLs content!
 

Users who are viewing this thread

Top