Google boosts V8 JavaScript performance

‘Super-fast’ non-optimizing Sparkplug compiler, which compiles bytecode to machine code, makes its debut in V8 9.1 and Chrome 91.

Google’s Sparkplug sparks V8 JavaScript performance
Thinkstock

With the Sparkplug compiler, Google is looking to improve JavaScript performance in its Chrome browser. Sparkplug is debuting in Chrome 91. 

Featured as part of Chrome’s V8 JavaScript/WebAssembly engine, Sparkplug is positioned as a “super-fast” non-optimizing compiler. In a bulletin published May 27, Sparkplug is described as part of a compiler pipeline, nestled between the Ignition interpreter and the TurboFan optimizing compiler. 

Sparkplug compiles from bytecode rather than from JavaScript source. In other words, Sparkplug compiles functions that already have been compiled to bytecode; the bytecode compiler already having done work such as variable resolution, determining if parentheses actually are arrow functions, and desugaring destructuring statements.

And unlike most compilers, Sparkplug does not generate any intermediate representation. Instead, it compiles directly to machine code via a single linear pass over the bytecode, emitting code that matches the execution of that bytecode. The entire compiler is a switch statement inside a for loop that dispatches machine code generation functions.

Google’s V8 developers noted that, since 2016, they have moved away from tracking synthetic benchmarks, such as Octane, to measuring real-world performance of JavaScript outside of the optimizing compiler. Thus, the team has been working on several other aspects of V8 including the parser, streaming, the object model, and caching compiled code.

Copyright © 2021 IDG Communications, Inc.