Home>Article>Web Front-end> Choose the best JS engine for your Node application
Node.js is developing rapidly. CurrentlyNode.js 8 has been released. At the same time, a Node.js version based on ChakraCore is also under active development.
【Video tutorial recommendation:node js tutorial】
The original text is: The recent Node.js v8 version (not to be mistaken with V8, the JavaScript engine)has just been published.
The original author used the wordNode.js v8 version, for which the author specifically explained in brackets that the V8 here is not the javascript engine V8 , but the Node.js version. But there is a note in the official Node.js blog postNode v8.0.0 (Current):
Note that, when referring to Node.js release versions, we have dropped the "v" in Node.js 8. Previous versions were commonly referred to as v0.10, v0.12, v4, v6, etc. In order to avoid confusion with V8, the underlying JavaScript engine, we've dropped the "v " and call it Node.js 8.
Please note that when referring to the Node.js release version, we have removed the "v" in Node.js 8. Previous versions are often called v0.10, v0.12, v4, v6, etc. To avoid confusion with the V8 JavaScript engine, we dropped the “v” and called it Node.js 8.
So, the Node.js v8 version should be directly called Node.js 8.
Because the JavaScript engine used by Node.js does not know when new features will be introduced, developers clearly know the performance advantages and disadvantages of different engines.
We have performed performance evaluation on the following Node.js versions:
You can view the performance of different versions for different features through this simpleVisualization Tool.
In these results, if you are using Node.js 8, you can also view the javascript performance after turning on the--turbo --ignition
parameter.
Although V8 is the default JavaScript engine used by Node.js, Node.js provides a common platform that allows developers to choose different JavaScript engines.
The release of Node.js 8 is very exciting and a big event within the community. The platform already comes with a whole new set of features. In addition, developers are most concerned about performance.
Knowing which JavaScript engine is best for running your application will be a very useful skill. In this article, we’ll look at the performance pros and cons of different versions of V8 and ChakraCore.
To compare benchmarks between different Node.js versions, I selected a representative set of 35 JavaScript code patterns. Most of them are taken fromColin Ihrig’s ‘will it optimize’repo. These patterns have been discussed in the previous article (Optimize your Node app by simply upgrading Node.js).
For each pattern, each different version of Node.js was run 10 times, 100 times, 1000 times, 10000 times and 10000 times. By enabling this code, we can understand how each engine performs runtime general optimizations and hot function optimizations.
The benchmark does not take into account the number of garbage collection (GC) events. This means that the results of the experiment may differ if the memory allocated to each process is modified.
You can view the complete test results onthis page. By analyzing this result, we can see that the Node.js version of ChakraCore is slower than the V8-based version.
Additionally, in most cases, migrating to V8 becomes more and more efficient over time. The Ignition and Turbofan optimization architecture significantly improves performance. Node.js 8 is released with V8 5.8, butis not enabled by default. Future versions of Node.js will be available with V8 5.9 (and possibly 5.6) with Ignition and Turbofan enabled.
This benchmark was very interesting and I plan to add more Node.js versions and more code patterns in the future. As a Node.js engineer at Sqreen, I care deeply about performance.
(Translation note: There are also 4-end content later, most of which are advertisements from the original author, so they will not be translated)
Finally, I recommend this powerful performance visual comparison tool developed by the author:Picking the best JS engine for your Node app's performanceAnd my lecture:Front-end programmers should know some V8 knowledge.
English original address: https://blog.sqreen.com/javascript-engine-performance/
For more programming-related knowledge, please visit:Programming teaching! !
The above is the detailed content of Choose the best JS engine for your Node application. For more information, please follow other related articles on the PHP Chinese website!