Google boosts the performance of JavaScript V8


With the Sparkplug compiler, Google seeks to improve the performance of JavaScript in its Chrome browser. Sparkplug debuts in Chrome 91.

Presented as part of Chrome’s JavaScript / WebAssembly V8 engine, Sparkplug is positioned as an unoptimized “ultra-fast” compiler. In one bulletin published on May 27, Sparkplug is described as part of a compiler pipeline, nestled between the Ignition interpreter and the TurboFan optimization compiler.

Sparkplug compiles from bytecode rather than JavaScript source. In other words, Sparkplug compiles functions that have already been compiled into bytecode; the bytecode compiler having already done such work as variable resolution, determining whether parentheses are really arrow functions, and disaggregating destructuring instructions.

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 corresponds to the execution of that bytecode. The whole compiler is a switch declaration inside a for loop that distributes machine code generation functions.

Google’s V8 developers noted that since 2016, they’ve moved from tracking synthetic benchmarks, such as Octane, to measuring actual JavaScript performance outside of the optimization compiler. So the team worked on several other aspects of V8, including parser, streaming, object model, and caching of compiled code.

Copyright © 2021 IDG Communications, Inc.

Source link

Leave A Reply

Your email address will not be published.