Better ASync From V8 JavaScript Engine |
Written by Ian Elliot | |||
Thursday, 10 January 2019 | |||
The developers of V8, Google's JavaScript engine, have expanded on how the latest release improves async functions and promises, as well as making it easier to debug async code. V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, and implements ECMAScript and WebAssembly. The latest release, V8 v7.2, comes with a faster
Writing on the V8 blog, developers Maya Lekova and Benedikt Meurer explain that historically, asynchronous processing in JavaScript has had a reputation for not being particularly fast. It's also hard to debug live JavaScript applications when it comes to async programming. However, improvements to recent versions have greatly improved matters. Async functions are faster, and the performance of asynchronous code increased significantly between V8 v5.5 (Chrome 55 & Node.js 7) and V8 v6.8 (Chrome 68 & Node.js 10), to the point where you can now use async techniques without having to worry about speed. The performance improvements are based on a number of changes, starting with the optimizing compiler, TurboFan; and the garbage collector, Orinoco. More recently, the development team has made use of what they say is: "a handy bug in Node.js 8 that caused await to skip microticks in some cases, resulting in better performance" The team formalized the bug to deliberately return faster by removing two extra unneeded microticks by only creating a wrapper promise and resolving it when those operations are actually needed. In situations where the value passed to await is already a promise, those steps are skipped. The developers also avoid creating a throwaway promise unless it's needed. These changes have significantly reduced the overhead of async functions, not just in V8, but across all JavaScript engines. The most recent release, V8 release v7.2, has also improved JavaScript parsing. The engineers say that on average web pages spend 9.5% of the V8 time at startup on parsing JavaScript. By moving to use V8’s fastest JavaScript parser yet, the team has seen dramatically improved parsing speed across the board, up by roughly 30% in desktop use since v7. The full explanation of the improvements to async can be found on the V8 blog.
More InformationRelated ArticlesMicrosoft Tears Node.js From V8
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info
<ASIN:1871962560> <ASIN:1871962579>
|
|||
Last Updated ( Thursday, 10 January 2019 ) |