Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
uint8Array vs plain array, small, random get/set
Test copying a random index to another random index on a small uint8Array vs a plain array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
uint8Array get/set
395937056.0 Ops/sec
plain array get/set
399349696.0 Ops/sec
Script Preparation code:
const uint8Array = new Uint8Array(81); const simpleArray = new Array(81); let temp = 0; let r = 0; for(let i = 0; i < 81; i++) { uint8Array[i] = simpleArray[i] = Math.floor(Math.random() * 2); }
Tests:
uint8Array get/set
for (let i; i < 10000; i++) { r = Math.floor(Math.random() * 81); temp = uint8Array[r]; r = Math.floor(Math.random() * 81); uint8Array[r] = temp; }
plain array get/set
for (let i; i < 10000; i++) { r = Math.floor(Math.random() * 81); temp = simpleArray[r]; r = Math.floor(Math.random() * 81); simpleArray[r] = temp; }