GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — buffer: use typed arrays for 64-bit BigInt accessors by gurgunday · Pull Request #67549 · nodejs/node Conversation
Member
readBig(U)Int64{LE,BE}() and writeBig(U)Int64{LE,BE}() assembled and split values with BigInt arithmetic, allocating intermediate BigInts on every call. Copy the bytes through BigInt64Array and BigUint64Array views over the existing 8-byte scratch buffer instead, as the double accessors already do
The other types are within noise (−1.48 % to +1.88 %).
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
readBig(U)Int64{LE,BE}() and writeBig(U)Int64{LE,BE}() assembled and
split values with BigInt arithmetic, allocating intermediate BigInts on
every call. Copy the bytes through BigInt64Array and BigUint64Array
views over the existing 8-byte scratch buffer instead, as the double
accessors already do.
Range and bounds checks are unchanged, and the value is masked with
`& -1n` before the store so non-BigInt values still throw the same
TypeError instead of being coerced by the typed array.
benchmark/buffers/buffer-read.js now uses the value it reads. The
loop discarded it, which let V8 remove side-effect-free reads
altogether.
Assisted-by: claude:opus-5.5
Signed-off-by: Gürgün Dayıoğlu <[email protected]>
Collaborator
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #67549 +/- ## ========================================== + Coverage 90.66% 90.68% +0.01% ========================================== Files 799 800 +1 Lines 280245 280963 +718 Branches 54121 54287 +166 ========================================== + Hits 254097 254800 +703 + Misses 16277 16254 -23 - Partials 9871 9909 +38
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Landed in 41918c1 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
readInt64() and readUint64() added a value's two 32-bit words as bigints, which allocated a bigint for each. They now copy the bytes to a scratch DataView and read the value from it, as readFloat64() does, and as nodejs/node#67549 changed Buffer's accessors to.
readBig(U)Int64{LE,BE}() and writeBig(U)Int64{LE,BE}() assembled and
split values with BigInt arithmetic, allocating intermediate BigInts on
every call. Copy the bytes through BigInt64Array and BigUint64Array
views over the existing 8-byte scratch buffer instead, as the double
accessors already do.
Range and bounds checks are unchanged, and the value is masked with
`& -1n` before the store so non-BigInt values still throw the same
TypeError instead of being coerced by the typed array.
benchmark/buffers/buffer-read.js now uses the value it reads. The
loop discarded it, which let V8 remove side-effect-free reads
altogether.
Assisted-by: claude:opus-5.5
Signed-off-by: Gürgün Dayıoğlu <[email protected]>
PR-URL: #67549
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
readBig(U)Int64{LE,BE}() and writeBig(U)Int64{LE,BE}() assembled and
split values with BigInt arithmetic, allocating intermediate BigInts on
every call. Copy the bytes through BigInt64Array and BigUint64Array
views over the existing 8-byte scratch buffer instead, as the double
accessors already do.
Range and bounds checks are unchanged, and the value is masked with
`& -1n` before the store so non-BigInt values still throw the same
TypeError instead of being coerced by the typed array.
benchmark/buffers/buffer-read.js now uses the value it reads. The
loop discarded it, which let V8 remove side-effect-free reads
altogether.
Assisted-by: claude:opus-5.5
Signed-off-by: Gürgün Dayıoğlu <[email protected]>
PR-URL: nodejs#67549
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.