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.

v8logo

 

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.

 

v8logo

 

 

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.

Banner


IBM Updates Granite Models
28/10/2024

IBM has released new Granite models that it says provide state-of-the-art performance relative to model size. The Granite 3.0 collection includes a new, instruction-tuned, dense decoder-only LLM.



Apollo Adds REST APIs For GraphQL
29/10/2024

Apollo has added a simpler way to integrate REST APIs into a federated GraphQL environment. Available now in public preview, can be used to map REST API endpoints to their GraphQL schema using a decla [ ... ]


More News

espbook

 

Comments




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