Does Microsoft's ChakraCore provide any performance benefit over Google's V8 when used as JS Engine for Node.js [closed]
Asked Answered
D

2

23

[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.

Dinse answered 24/5, 2016 at 7:53 Comment(6)
No, I have recently seen people being eager to down vote before even reading the question.. Let me edit it... Sorry...Dinse
@Jai, Should I take it down? Actually I have seen Detailed and Point wise, real educative answers a lot in Stack Overflow. So, was really hoping to get some comparative insights over here... Not asking for anyone's Favorite JS Engine, but the Real Hero :PDinse
Well you don't have to worry about js engines, why one should know what is in the V8 or ChakraCore? All this is a js engine one is good and another one trying to be good.Jeane
Yes it's right that it will not hamper my day to day job in anyway. For now it's just curiosity. But if I may say, it's also being prepared for the day when (and if) I'm asked to choose one between V8 and Chakra, I have some facts to make the decision upon.Dinse
well then one have to test against two engines, can't say exactly any one has tested it against it or not. But will update the answer with the tests for sure.Jeane
@Jai, That's what I'm looking for... :) I am also studying it myself from their (MS) github repo...Dinse
L
25

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.

Lalo answered 24/5, 2016 at 9:15 Comment(4)
My question might be closed eventually due to heavy close voting. But this answer is helpful and very close to what I am looking for. Also Thanks for pointing out that benchmark comparison. Have my Upvote :) @Alex BookerDinse
@SumanBarick Feel free to accept the answer before the question is closed haha 😆. Glad I could help!Lalo
V8 also has an interpreter: youtube.com/watch?v=r5OWCtuKiAkPieria
The video has since been made private. But this one mentions time-travel in ChakraCore: youtu.be/zGmQR7iBfD4 and is still public.Heda
J
5

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.

Jeane answered 24/5, 2016 at 8:11 Comment(2)
Thanks for the webassembly link :) @JeaneDinse
Chakracore can execute any javascript code?Dysphemia

© 2022 - 2024 — McMap. All rights reserved.