[I have Edited my question to narrow down the scenario to only Node.js. Please Re-Open it. It is a helpful question and Proper answers might come in future and not sooner as ChakraCore is still at very young age. But this question is Valid and Should be here]
We all have known / read / heard about the glory of Google's V8 Engine and how it has made node.js the beauty it is, for years.
But now that we have an option to choose between Microsoft's ChakraCore and Google's V8 as our preferred JavaScript Engine, I am wondering if someone has any evidence, or test cases where they have found one to be more efficient than another for nodejs.
Please back your answer with some facts and results, because someone should not be using/choosing Chakra only because he/she loves Microsoft or and same applies for V8 and Google.
Thanks.
V8 is required for the current Node. js engine to function. In the absence of V8, it wouldn't have a JavaScript engine, and thus wouldn't be able to run JavaScript code. The V8 interface between C++ and JavaScript is used by the native code bindings that come with Node.
Node. js is just a runtime environment that supports the execution of a program. V8 is at the core of Node.
Chrome V8 is a JavaScript engine, which means that it executes JavaScript code. Originally, JavaScript was written to be executed by web browsers. Chrome V8, or just V8, can execute JavaScript code either within or outside of a browser, which makes server-side scripting possible.
V8 is the fastest, because it compiles all JS to machine code. SpiderMonkey (what FF uses) is fast too, but compiles to an intermediate byte-code, not machine code.
How they are different?
Whereas most modern JavaScript engines translate all JavaScript code into efficient machine code (source), Chakra has an intelligent and high-performance interpreter. This interpreter has intelligent heuristics that can determine whether to compile your code into machine code or interpret it. An interpreter is usually faster to start and requires less memory to run, which makes Chakra very attractive for resource-constrained environments (such as a Raspberry Pi).
In 2015 Microsoft introduced support for Node.js with Chakra to allow developers to target the Windows IoT Core platform. The recent open-sourcing of ChakraCore has allowed Microsoft to develop in the open and align better with Node.js release schedules.
In a recent JavaScript Air episode, Steve Lucco mentioned that the Chakra team are planning to "really take the community seriously and take their input seriously in terms of the direction that the engine will go [and] give the community a lot more input than, for example, they have had in the direction of V8".
In striving to build a memory efficient JavaScript engine, Microsoft have actually built a competitively fast one. At the time this article was written, Chakra outperformed V8 in some cases:
(source: msecnd.net)
Benchmarks aren't necessarily indicative of real-world performance but this competition in VM performance will eventually lead to a faster Node.js runtime for users of all VMs.
It's also worth mentioning that having their own JavaScript engine will allow Microsoft to freely innovate. One early innovation is time-travel debugging.
How they are different?
Well the question is bit too broad to answer currently in the format but i will try answering it.
Google's V8 engine has all the features which is required to have a blazing fast performance out of it. So, basically this one is the base for the nodejs for quite a while and it will be there for long run.
On the other hand Microsoft's ChakraCore is also been actively developed and it has two layer structure (unable to name it) with Chakra Shim and ChakraCore.
Thing to notice Chakra 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.
Source: NodeJs-ChakraCore
For OP: Look for webassembly too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With