Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
uint8Array vs plain array, small, random get/set
(version: 2)
Test copying a random index to another random index on a small uint8Array vs a plain array
Comparing performance of:
uint8Array get/set vs plain array get/set
Created:
one year ago
by:
Registered User
Jump to the latest result
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; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
uint8Array get/set
plain array get/set
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser/OS:
Chrome 132 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
uint8Array get/set
107680216.0 Ops/sec
plain array get/set
104558176.0 Ops/sec
Related benchmarks:
array vs int32Array
For vs Min1
TypedArray vs Array
Uint8Array vs Uint32Array
UInt8Array vs cast to array index access
UInt8Array vs cast to array index access 10k
Splice vs new Array
find array
copy ArrayBuffer: Uint8Array.set vs by bytes
Comments
Confirm delete:
Do you really want to delete benchmark?