Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Buf to BigInt vs BigInt to Buf
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Buf to BigInt
5184725.5 Ops/sec
BigInt to Buf
2109030.0 Ops/sec
Script Preparation code:
function hashToBigInt(hash) { const view = new DataView(hash.buffer); return (view.getBigUint64(0) << 64n) | view.getBigUint64(8); } function bigIntToHash(n) { const hash = new Uint8Array(16); const view = new DataView(hash.buffer); view.setBigUint64(0, n >> 64n); view.setBigUint64(8, n); return hash; } const hashes = []; const hashInts = []; for (let i = 0; i < 1; i++) { const hash = new Uint8Array(16); window.crypto.getRandomValues(hash); hashes.push(hash); hashInts.push(hashToBigInt(hash)); } function getHashes() { return hashes; } function getHashInts() { return hashInts; }
Tests:
Buf to BigInt
for (const hash of getHashes()) { hashToBigInt(hash); }
BigInt to Buf
for (const hashInt of getHashInts()) { bigIntToHash(hashInt); }