A New JavaScript Compiler Aims to Improve Chrome’s Overall Speed

Google Chrome application icon on Apple iPhone X screen close up
BigTunaOnline/Shutterstock.com

Google has now rolled out a new JavaScript compiler, dubbed Sparkplug, for its V8 JavaScript engine in Chrome. Sparkplug’s engineers assure it’ll create a faster web experience, and that it does so by “cheating.”

The new compiler is part of the Chrome 91 update, which Google rolled out on Tuesday. Along with Sparkplug, the release also includes security updates and other critical changes that will boost the JavaScript engine.

Thomas Nattestad, a Chrome product manager, said, “An important component of delivering a fast browser is fast JavaScript execution. In Chrome, that job is done by the V8 engine which executes over 78 years worth of JavaScript code on a daily basis. In M91 Chrome is now up to 23% faster with the launch of a new Sparkplug compiler and short builtin calls, saving over 17 years of our users’ CPU time each day.”

The compiler is a welcome addition to the JavaScript pipeline, as it acts as an intermediary between the existing Ignition and Turbofan compilers. Ignition interprets the bytecode and Turbofan optimizes the high-performance machine code. Both do a solid job, but it takes time to process and optimize all the code.

JavaScript programming language with script code on laptop screen
fatmawati achmad zaenuri/Shutterstock.com

As Nattestad explains, “Sparkplug strikes a balance between Ignition and Turbo fan in that it does generate native machine code but does not depend on information gathered while executing the JavaScript code. This lets it start executing quickly while still generating relatively fast code.”

And Sparkplug “cheats” its way to efficiency by compiling functions already compiled to bytecode. Leszek Swirski, one of Sparkplug’s engineers, explains that “the bytecode compiler has already done most of the hard work like variable resolution, figuring out if parentheses are actually arrow functions, desugaring destructuring statements, and so on. Sparkplug compiles from bytecode rather than from JavaScript source, and so doesn’t have to worry about any of that.”

Explaining the intricacies can get super technical, super fast, however. If you’re into that, you can read the entire V8 Devs blog post here. For the rest of us, all you really need to know is that Chrome is going to move a little faster now, which is good news for everyone.

via ZDNet

Suzanne Humphries Suzanne Humphries
Suzanne Humphries is the Commerce Editor for Review Geek. She has over six years of experience across multiple publications researching and testing products, as well as writing and editing news, reviews, and how-to articles covering software, hardware, entertainment, networking, electronics, gaming, apps, security, finance, and small business. Read Full Bio »

The above article may contain affiliate links, which help support Review Geek.