|Written by Kay Ewbank|
|Monday, 06 January 2020|
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."
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.
or email your comment to: firstname.lastname@example.org