Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS BigInt To Uint8Array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0
Browser:
Firefox 100
Operating system:
Linux
Device Platform:
Desktop
Date tested:
4 months ago
for-loop
4.8M/s
dataview
2.6M/s
View exact numbers
Test name
Executions per second
✓
for-loop
4,785,396 Ops/sec
dataview
2,624,675 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function bigIntToBigEndianBytesLoop(value) { const hex = value.toString(16).padStart(8 * 2, '0'); const bytes = new Uint8Array(8); for (let i = 0; i < 8; i++) { bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16); } return bytes; } function bigIntToBigEndianBytesDataView(value) { const buf = new ArrayBuffer(8); const view = new DataView(buf); view.setBigUint64(0, value); return new Uint8Array(buf); }
Tests:
for-loop
bigIntToBigEndianBytesLoop(2382975329865n);
dataview
bigIntToBigEndianBytesDataView(2382975329865n);