Home > Web Front-end > JS Tutorial > Choose the best JS engine for your Node application

Choose the best JS engine for your Node application

青灯夜游
Release: 2020-09-08 12:25:56
forward
2014 people have browsed it

Choose the best JS engine for your Node application

Node.js is developing rapidly. Currently Node.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 word Node.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 post Node 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:

  • Node.js 6.10.1 (V8 5.1.281.95)* Node.js 7.10 (V8 5.5. 372.43)
  • Node.js 7.10 using --turbo --ignition parameter (V8 5.5.372.43)
  • Node.js 8.0 (V8 5.8.283.41)
  • Node. js 8.0 using --turbo --ignition parameter (V8 5.8.283.41)
  • Node.js 8.0 (ChaKraCore 2.0.0.0) (using 2 different build versions)

You can view the performance of different versions for different features through this simple Visualization 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.

Context

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.

How

To compare benchmarks between different Node.js versions, I selected a representative set of 35 JavaScript code patterns. Most of them are taken from Colin 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.

Results

Choose the best JS engine for your Node application

You can view the complete test results on this 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, but is 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.

Conclusion

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 performance And 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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template