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 async/await implementation that is enabled by default.

v8logo

 

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.

v8logo

 

 

More Information

Fast Async On V8 Blog

V8 Website

Related Articles

Node.js Updated

Node.js Foundation Survey

Node.js Foundation Heals Rift

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

Banner


AI At edX With 30% Savings
13/12/2024

edX is offering a 30% discount on selected courses and program bundles until December 19th. We look at  AI-related certifications that could boost your resume in 2025.



Ruby On Rails Adds Kamal And Thruster Support
17/12/2024

Ruby on Rails 8 has been released. The new version comes preconfigured with Kamal 2 for application deployment, a new proxy called Thruster, and a trio of SQLite database-backed adapters named Solid C [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

<ASIN:1871962560>

<ASIN:1871962579>

 

 

Last Updated ( Thursday, 10 January 2019 )