V8 JavaScript Engine Reduces Heap Size
Written by Kay Ewbank   
Monday, 06 January 2020

The latest release of V8, Google's open source JavaScript engine, will reduce heap size by 40 percent by using pointer compression when it is released alongside Chrome 80 stable in a few weeks.

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, and implements ECMAScript and WebAssembly.



The reduction in the size of the V8 heap comes from the fact that the developers looked closely at what (which represent pointers into the V8 heap or small integers) occupy the majority of the heap. Tagged values are as big as the system pointer: they are 32 bits wide for 32-bit architectures, and 64 bits in 64-bit architectures. However, the developers realized that the top bits of the tagged values can be synthesized from the lower bits, meaning V8 only needs to store the unique lower bits into the heap, saving an average of 40% of the heap memory. Writing about the saving on the V8 blog, Leszek Swirski said:

"When improving memory, usually it comes at the cost of performance. Usually. We are proud to announce that we saw improvements in performance on real websites in the time spent in V8, and in its garbage collector."

Other improvements to the new release are to its JavaScript support. New in this release is support for optional chaining and for nullish coalescence. Optional chaining helps avoid exceptions if intermediate values are null or undefined, meaning programmers can write terser, robust chains of property accesses that check if intermediate values are nullish. If an intermediate value is nullish, the entire expression evaluates to undefined.

The nullish coalescing operator ?? is a new short-circuiting binary operator for handling default values. Until now, default values have often been handled with the logical operator, but this has disadvantages as it can result in the wrong value being reached. With the nullish coalescing operator, a ?? b evaluates to b when a is nullish (null or undefined), and otherwise evaluates to a. This is the desired default value behavior, and avoids the incorrect result which would have resulted from using the logical operator.





More Information

V8 Website

Related Articles

Google JavaScript Engine Speeds JSON Parsing

Better ASync From V8 JavaScript Engine

Node.js Updated

Node.js Foundation Survey

Node.js Foundation Heals Rift

Microsoft Tears Node.js From V8



To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


PeerDB Brings Real Time Streaming To PostgreSQL

PeerDB is an ETL/ELT tool built for PostgreSQL. It makes all tasks that require streaming data from PostgreSQL to third party counterparts as effortless as it gets.

Liberica Joins The Java CRaC Train

CRaC is a novel technique that makes the JVM faster to start.
Liberica's JDK build has just added support for it. Here are the details.

More News




or email your comment to: comments@i-programmer.info