Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
TypedArray fill vs instantiation
(version: 1)
Is a reset by fill() that much slower than instantiating a new TypedArray, that frequent re-allocations is preferred?
Comparing performance of:
Instantiate vs Zero fill
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
let arr = new Float32Array(1000);
Tests:
Instantiate
arr = new Float32Array(1000);
Zero fill
arr.fill(0);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Instantiate
Zero fill
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser/OS:
Firefox 135 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Zero fill
2.2M/s
Instantiate
1.7M/s
View exact numbers
Test name
Executions per second
✓
Zero fill
2,190,766 Ops/sec
Instantiate
1,658,208 Ops/sec
Related benchmarks
Array fill method vs for loop
Array fill method vs for loop__
TypedArray fill vs loop
Array(length).fill() vs Array.from({ length: length })
Array() vs new Array() fill
Comments
Confirm delete:
Do you really want to delete benchmark?