Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Big Int to Uint8Array
(version: 1)
Comparing performance of:
Direct vs Hex
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function bigIntToUint8Array64LE_direct(num) { const result = new Uint8Array(8); result[0] = Number(num & 0xffn); result[1] = Number((num >> 8n) & 0xffn); result[2] = Number((num >> 16n) & 0xffn); result[3] = Number((num >> 24n) & 0xffn); result[4] = Number((num >> 32n) & 0xffn); result[5] = Number((num >> 40n) & 0xffn); result[6] = Number((num >> 48n) & 0xffn); result[7] = Number((num >> 56n) & 0xffn); return result; } function bigIntToUint8Array64LE_hex(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; }
Tests:
Direct
bigIntToUint8Array64LE_direct(538753629635n)
Hex
bigIntToUint8Array64LE_hex(538753629635n)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Direct
Hex
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser/OS:
Firefox 133 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Direct
5327440.5 Ops/sec
Hex
1392690.5 Ops/sec
Related benchmarks:
JS number to UInt8Array 64-bit little endian
JS number to UInt8Array 64-bit little endian 2
Test uint32array ant biguint64array
JS BigInt To Uint8Array
BigInt to BigEndian Bytes
BigInt to BigEndian Bytes - with AB
BigInt to BigEndian Bytes (extended by trincot)
BigInt to BigEndian Bytes (extended by trincot, v2)
BigInt to BigEndian Bytes (extended by trincot, v3)
Comments
Confirm delete:
Do you really want to delete benchmark?