Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array initialization: preallocate a typed array vs vanilla preallocation
(version: 1)
Comparing performance of:
Preallocate typed vs Preallocate vanilla
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
Preallocate typed
var N = 10000; var result = new Uint8Array(N); for (var i = 0; i < N; i++) { result[i] = i; }
Preallocate vanilla
var N = 10000; var result = new Array(N); for (var i = 0; i < N; i++) { result[i] = i; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Preallocate typed
Preallocate vanilla
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser/OS:
Chrome 145 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Preallocate typed
129397.6 Ops/sec
Preallocate vanilla
172044.1 Ops/sec
Related benchmarks:
Array constructor vs literal
Array initialization: preallocate vs push
optimized loop
Array vs Typed Array vs Buffer Typed Array
Array vs TypedArray write performance
Array initialization: preallocate vs push vs preallocate & fill
Array initialization: preallocate_add_end vs push
Another array[len - 1] vs array.at(-1)
Array initialization: preallocate vs push (Objects)
Comments
Confirm delete:
Do you really want to delete benchmark?