Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test array ops
(version: 1)
Comparing performance of:
Test 1 vs Test 2
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
Test 1
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ const arr = new Array(10000).fill(0).map(_ => Math.random()) const typed = Float64Array.from(arr) const windowSize = 5000; let sums = []; for(let start = 0; windowSize + start < arr.length; start++) { const window = typed.subarray(start, windowSize+start) sums.push(window[100]) }
Test 2
const arr = new Array(10000).fill(0).map(_ => Math.random()) const windowSize = 5000; let sums = []; for(let start = 0; windowSize + start < arr.length; start++) { const window = arr.slice(start, windowSize + start) sums.push(window[100]) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Test 1
Test 2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0
Browser/OS:
Firefox 136 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Test 1
2347.6 Ops/sec
Test 2
219.5 Ops/sec
Related benchmarks:
reate array by lenght
Assigning new variable
Float32Array Vec3 init
Test array concat
Test array concat with larger array
me vs chatgpt
new Array(length).fill vs Array.from({ length })
new Array(length).fill().map vs Array.from({ length }, callback)
js mul vs pow
Comments
Confirm delete:
Do you really want to delete benchmark?