Google has released new V8 JavaScript engine for the Chrome browser and the Node.js JavaScript runtime, with enhancements in language and security features in the Version 6.7 branch, which is still in beta.
The V8 6.7 engine brings support for BigInt by default, while BigInts are a new numeric primitive in JavaScript that can represent integers with arbitrary precision. Also BigInt makes it possible to perform integer arithmetic without overflowing, and serve as the basis of an eventual BigDecimal implementation, which is useful in representing sums of money with decimal precision.
While a PC stores integers in the CPU’s registers (which are usually 32 or 64 bits wide), or in register-sized chunks of memory, which leads to minimum and maximum values, for instance, a 32-bit signed integer can hold values from -2,147,483,648 to 2,147,483,647. But the idea of BigInts is to remove the restriction by such limits.
That also enables countless new possibilities, even as Arbitrary-precision integers unlock lots of new use cases for JavaScript.
Formerly, Java applications with any of these use cases had to resort to userland libraries that emulate BigInt-like functionality. But with BigInt such applications can drop these run-time dependencies in favor of native BigInts, which helps to reduce load time, parse time, and compile time, and above all that it offers significant run-time performance improvements.
The proposal includes two new TypedArray flavors: BigInt64Array and BigUint64Array, and TypedArrays with 64-bit wide integer elements are now possible since BigInts provide a natural way to read and write all the bits in those elements, whereas if one tried to use Numbers for that, some bits might get lost.
For computationally heavy applications on 64-bit values and running on 64-bit hardware, keeping those values in registers would be much more efficient than allocating them as objects on the heap.
Google’s V8 JavaScriptengine gets Language and Security enhancements
Google has released new V8 JavaScript engine for the Chrome browser and the Node.js JavaScript runtime, with enhancements in language and security features in the Version 6.7 branch, which is still in beta.
The V8 6.7 engine brings support for BigInt by default, while BigInts are a new numeric primitive in JavaScript that can represent integers with arbitrary precision. Also BigInt makes it possible to perform integer arithmetic without overflowing, and serve as the basis of an eventual BigDecimal implementation, which is useful in representing sums of money with decimal precision.
While a PC stores integers in the CPU’s registers (which are usually 32 or 64 bits wide), or in register-sized chunks of memory, which leads to minimum and maximum values, for instance, a 32-bit signed integer can hold values from -2,147,483,648 to 2,147,483,647. But the idea of BigInts is to remove the restriction by such limits.
That also enables countless new possibilities, even as Arbitrary-precision integers unlock lots of new use cases for JavaScript.
Formerly, Java applications with any of these use cases had to resort to userland libraries that emulate BigInt-like functionality. But with BigInt such applications can drop these run-time dependencies in favor of native BigInts, which helps to reduce load time, parse time, and compile time, and above all that it offers significant run-time performance improvements.
The proposal includes two new TypedArray flavors: BigInt64Array and BigUint64Array, and TypedArrays with 64-bit wide integer elements are now possible since BigInts provide a natural way to read and write all the bits in those elements, whereas if one tried to use Numbers for that, some bits might get lost.
For computationally heavy applications on 64-bit values and running on 64-bit hardware, keeping those values in registers would be much more efficient than allocating them as objects on the heap.
No comments