New Google tool cuts JavaScript code down to size

Google's Ignition interpreter lowers memory consumption -- and that's only the beginning for this V8 engine component

New Google tool cuts JavaScript code down to size
Credit: Pixabay

Working to improve mobile memory consumption in its V8 JavaScript engine, Google has developed Ignition, a JavaScript interpreter to cut overhead and boost execution of scripts. Google sees the technology offering other opportunities to increase web performance as well.

Through Ignition, V8 compiles JavaScript functions to a concise bytecode that's 25 to 50 percent the size of equivalent baseline machine code, Ross McIlroy, Google engineer for Android software, said. "This bytecode is then executed by a high-performance interpreter, which yields execution speeds on real-world websites close to those of code generated by V8's existing baseline compiler."

Adding Ignition to the script execution pipeline opens up possibilities beyond reducing V8 memory overhead, according to McIlroy. "The Ignition pipeline has been designed to enable us to make smarter decisions about when to execute and optimize code to speed up loading web pages and reduce jank and to make the interchange between V8's various components more efficient," he said.

V8 and other engines leverage JiT compilation of script to native machine code for performance purposes. With V8, the script execution pipeline has conditions requiring complex machinery to switch between the baseline compiler and two other optimizing compilers: CrankShaft and TurboFan. With this process, "JiTed" machine code can consume lots of memory even if code is executed only once. Ignition, which can replace V8's baseline compiler, executes code with less memory overhead and paves the way for a simpler script execution pipeline, McIlroy explained.

The interpreter uses low-level, architecture-independent macro-assembly instructions from TurboFan to generate bytecode handlers for op codes. TurboFan compiles instructions to the target architecture, providing low-level instruction selection and machine register allocation. "This results in highly optimized interpreter code, which can execute the bytecode instructions and interact with the rest of the V8 virtual machine in a low-overhead manner, with a minimal amount of new machinery added to the codebase," said McIlroy.

Android devices with 512MB of memory or less and running the Chrome 53 browser should enable Ignition. "Results from early experiments in the field show that Ignition reduces the memory of each Chrome tab by around 5 percent," McIlroy noted.

This story, "New Google tool cuts JavaScript code down to size" was originally published by InfoWorld.

Notice to our Readers