Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News V8 JavaScript Engine 7.4, 7.5, and 7.6 Add Numerous Performance Improvements

V8 JavaScript Engine 7.4, 7.5, and 7.6 Add Numerous Performance Improvements


The recent 7.4, 7.5, and 7.6 versions of Google's V8 JavaScript engine add several WebAssembly features and JavaScript performance improvements.

V8 version 7.4 also adds WebAssembly Threads/Atomics. Originally included as an experimental feature in V8 7.0, threads and atomics allow for the usage of multiple cores with WebAssembly, supporting computation-heavy processes for the web.

Chrome 75 adds implicit caching for WebAssembly, allowing already-compiled WebAssembly modules to get pulled from the cache rather than recompiled upon each view. Non-Chromium users of V8 are encouraged to follow Chromium's approach to implicit caching.

WebAssembly also gets support for the bulk memory proposal in V8 version 7.5, providing new instructions to update large regions of memory or tables.

V8 version 7.4 adds support for the ECMAScript private class fields syntax, making these fields inaccessible outside the class body.

Numeric separators, a proposed feature expected to arrive with ES2020, are now supported with V8 version 7.5, making it easier for humans to read very large number literals.

Version 7.4 of V8 also adds support for Intl.Locale, part of the ECMA-402 internationalization specification, providing more robust mechanisms for managing locales and efficiently extracting locale-specific preferences.

V8 7.6 improves Intl.DateTimeFormat by adding support for formatRange and formatRangeToParts methods, making it easier to format date ranges in a locale-specific manner, and also add the timeStyle and dateStyle options.

Promise.allSettled(promises) is a new JavaScript language feature added in V8 7.6. This feature signals when all input promises get settled (fulfilled or rejected).

BigInt support now works in a locale-aware manner with the toLocaleString method in V8 7.6, as well as via the Intl.NumberFormat API.

V8's recent releases have made several JavaScript performance improvements.

V8 version 7.6 introduces a substantial set of updates to JSON.parse, and up to 2.7× faster parsing of data served. The main change is from a recursive parsing model to an iterative parser that manages its stack. Previously, V8 could run out of stack for very deeply nested JSON data, but now V8 is only limited by available memory for JSON parsing. The new JSON parser improves memory efficiency by optimizing the approach to buffering properties.

In V8 7.4, improvements were made to provide faster calls with mismatching arguments. JavaScript allows calling functions with too few (under-application) or too many (over-application) parameters than formally declared. Under-application scenarios get formal parameters assigned as undefined, whereas over-application ignores its extra parameters. However, because JavaScript functions may access the actual parameters via the arguments object, rest parameters, etc., V8 provides access to the real arguments via arguments adaption. V8 now determines scenarios where this adaptation is not needed (e.g., callee is a strict mode function), reducing call overhead as much as 60%.

Also in V8 7.4, calling into native accessors directly via their get functions was much slower in Chrome than monomorphic or megamorphic property access, by following a slower code path. V8 improves performance by calling into native accessors.

Large scripts in Chrome get streaming-parsed on worker threads while getting downloaded. In V8 7.4, a performance issue with custom UTF-8 decoding used by the source stream was fixed, resulting in an average 8% faster parse. Additionally, property names were getting deduplicated on parse. Fixing this issue improves streaming parser performance by an additional 10.5%, and also improves parse times for small non-streamed scripts and inline JavaScript.

With Chrome 75, V8 streams script directly from the network into their streaming parser, rather than waiting for the Chrome main thread. This change improves the performance of JavaScript parsing and reduces the number of concurrent streaming parse tasks, further reducing memory consumption.

V8 version 7.6 improves the performance of calls on frozen or sealed arrays on indexOf, includes, and various spread and apply calls. Fast, frozen, and sealed elements in V8 provide more detail around these improvements.

V8 now provides a JIT-less mode, supporting JavaScript execution without allocating executable memory at runtime. Typically, V8 relies on the runtime allocation and modification of executable memory, making V8 fast. But some platforms, such as iOS, smart TVs, and game consoles do not allow access to executable memory for non-privileged applications, perhaps to reduce the exploit surface area of an application. As of V* 7.4, the --jitless flag runs without runtime allocation of executable memory by switching V8 into an interpreter-only mode. WebAssembly does not currently get support with JIT-less mode.

V8 7.4 adds bytecode flushing, reducing V8's memory overhead by flushing compiled bytecode from infrequently executed functions during garbage collection. This change reduces the V8’s heap memory by 5–15% without regressing performance or significantly increasing CPU time compiling JavaScript.

V8 7.4 also improves the handling of bytecode dead basic block elimination. As explained by the V8 team,

While we don’t expect this to have a large impact on user code, it is particularly useful for simplifying various desugarings, such as generators, for-of and try-catch, and in particular removes a class of bugs where basic blocks could “resurrect” complex statements part-way through their implementation.

Unicode string handling receives a significant improvement in V8 7.6 for calls like as String#localeCompare, String#normalize, and various internationalization APIs.

Google creates branch releases of its V8 JavaScript engine every six weeks to coincide with Google Chrome releases. Version 7.4 of V8 ships with Chrome 74, 7.5 with Chrome 75, and 7.6 with Chrome 76. V8 also powers the Node.js JavaScript runtime.

V8 is open source software with several applicable licenses to subsets of the codebase due to external dependencies. Contributions are welcome via the V8 Git project and should follow V8's contribution guidelines and Google's open source conduct guidelines.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p