Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
uint8Array shallow cloning methods
uint8Array shallow cloning methods
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/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
slice()
91419064.0 Ops/sec
spread
102192776.0 Ops/sec
from()
100473248.0 Ops/sec
with()
81906104.0 Ops/sec
Script Preparation code:
const uint8array = new Uint8Array(81); for(let i = 0; i < 81; i++) { uint8array[i] = Math.floor(Math.random() * 2); }
Tests:
slice()
for (let i; i < 1000; i++) { const copy = uint8array.slice(); r = Math.floor(Math.random() * 81); copy[r] ^= 1; }
spread
for (let i; i < 1000; i++) { const copy = [...uint8array]; r = Math.floor(Math.random() * 81); copy[r] ^= 1; }
from()
for (let i; i < 1000; i++) { const copy = TypedArray.from(uint8array); r = Math.floor(Math.random() * 81); copy[r] ^= 1; }
with()
for (let i; i < 1000; i++) { r = Math.floor(Math.random() * 81); const copy = uint8array.with(r, uint8array[r] ^ 1); }