Google has shipped a new JavaScript compiler for its V8 JavaScript engine in Chrome called Sparkplug that promises a much faster web experience – and it does it by ‘cheating’, according to the engineers on the project. 

Sparkplug is part of Chrome 91, which Google released on Tuesday with security updates but also some key changes under the hood that improve its powerful JavaScript engine, V8. 

Microsoft relies on V8 these days too after ditching its Chakra JavaScript engine from legacy Edge and moving to Chromium for the new Edge browser and switching to V8. 

SEE: Managing and troubleshooting Android devices checklist (TechRepublic Premium)

Google says Chrome 91 has 23% faster performance thanks to Sparkplug’s integration into V8’s JavaScript pipeline. 

V8 plays an important role in the browser experience in virtually every page on the web since most of them rely on a browser executing JavaScript, the default language for front-end web development.

“An important component of delivering a fast browser is fast JavaScript execution,” explains Thomas Nattestad, a Chrome product manager in a blogpost

“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 Sparkplug compiler sits between V8’s Ignition bytecode interpreter and the TurboFan optimizing compiler.    

The V8 team has detailed its work on the Sparkplug compiler in a blogpost too, noting that Sparkplug improves browser performance because it “cheats” by relying on compiling heavy lifting already done by the Ignition interpreter. It calls its Sparkplug a “non-optimising JavaScript compiler”.

“First of all, it cheats; the functions it compiles have already been compiled to bytecode, and the bytecode compiler has already done most of the hard work… Sparkplug compiles from bytecode rather than from JavaScript source, and so doesn’t have to worry about any of that,” the V8 team said.  

“Sparkplug strikes a balance between Ignition and Turbofan 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,” explains Nattestad.

SEE: What is a software developer? Everything you need to know about the programmer role and how it is changing

For end users, this means a faster experience on the web. Google’s V8 JavaScript engine, which arrived in 2008, was an important shift in competition between browser makers. V8 let developers write much larger applications for the browser in JavaScript and gave Google Chrome and the open-source Chromium project a lead over other mainstream browsers.   

Microsoft is also claiming major performance improvements with its Chromium-based Edge 91 release. At its developer conference, it highlighted the ‘startup boost’ feature for faster page loads and sleeping tabs to drastically cut memory usage. With yesterday’s release of Edge 91, Microsoft now claims Edge is “the best performing browser on Windows 10.”



Source link