Profiling and Optimizing V8 Memory Consumption
For the last few months, the V8 team has focused on reducing the memory consumed by the V8 engine, including work on the newIgnition interpreter, and improvements to V8’s parser and compilers. A key enabler of this process was profiling V8 memory usage using specific tools against a benchmark, as explained by V8 engineers Ulan Degenbaev, Michael Lippautz, Hannes Payer, and Toon Verwaest.
The V8 team could also reduce the C++ heap size by improving background parsing, which allows V8 to parse script while the page is still being loaded. In fact, as the memory visualization tool showed, the background parser would keep a heap zone alive long after the code had been compiled, instead of releasing it immediately. Additionally, the V8 parser is now using a more aggressive strategy to pack fields in the abstract syntax tree nodes it generates, whereas the standard C++ packing was relied upon previously. Benchmarking showed a peak zone memory reduction of about 40% on average.
All improvements described above will be available in Chrome 55, expected to become available in December.