This morning, I came across an interesting little project that the Chromium dev team has been working on over the month of February.
It’s called Sparkplug, and while I don’t understand all of the low-level workings, I do understand the goal. Sparkplug is an “interpreter accelerator” for Chrome’s V8 engine that will compile bytecode to machine code. This means it will improve website performance on Chromebooks while using less power.
The Sparkplug design doc overview section explains what’s being worked on and why:
There is a trade-off space for compilers which balances compilation time and compiled code quality. The Ignition interpreter and the TurboFan optimising compiler are at two ends of this spectrum. However, there is a big performance cliff between the two; staying too long in the interpreter means we don’t take advantage of optimisation, but calling TurboFan too early might mean we “waste” time optimising functions that aren’t actually hot — or worse, it means we deopt. We can reduce this gap with a simple, fast, non-optimising compiler, that can quickly and cheaply tier-up from the interpreter by linearly walking the bytecode and spitting out machine code. We call this compiler Sparkplug.
The speed difference between SparkPlug and current V8 tools may not look that drastic, but keep in mind, this is for a single web page.
And it doesn’t require new hardware: It would help on every Chromebook currently out in the market that still gets software updates.
But there’s more.
This information from the design document outlines a another key benefit that come along for the ride:
Sparkplug by itself (without even TurboFan) has the lowest total CPU usage, which is valuable on pay-per-cycle servers and battery-powered devices.
Do I expect it to add an hour of extra battery life to a Chromebook during typical use? No. That’s not realistic. But even an extra 15 or 20 minutes of run-time spread out over days, weeks and months is a big benefit.