Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Binary to boolean with DataView: slice() with map() vs. slice() with for loop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
slice() with map()
422438.9 Ops/sec
slice() with for loop
8035.1 Ops/sec
Tests:
slice() with map()
const length = 1000; const arrayBuffer = new ArrayBuffer(length); const array = new Uint8Array(arrayBuffer); for (let i = 0; i < length; i++) { array[i] = 22; } const dataView = new DataView(arrayBuffer); const transferArray = new Uint8Array(dataView); const resultArray = [...transferArray].map(Boolean);
slice() with for loop
const length = 1000; const arrayBuffer = new ArrayBuffer(length); const array = new Uint8Array(arrayBuffer); for (let i = 0; i < length; i++) { array[i] = 22; } const dataView = new DataView(arrayBuffer); const transferArray = new Uint8Array(dataView); const resultArray = [...transferArray]; for (let i = 0; i < length; i++) { resultArray[i] = Boolean(resultArray[i]); }