Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array timing 100
(version: 1)
Comparing performance of:
Array.at(i) vs Array[i]
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const array = []; const indexes = []; const l = 999; const iterations = 9999; for (let i = 0; i < length; ++i) { array.push(Math.random()); } for (let i = 0; i < iterations; ++i) { indexes.push(Math.floor(Math.random() * l)); }
Tests:
Array.at(i)
let total = 0; for(let i = 0; i < iterations; ++i) { const index = indexes[i]; total += array.at(index); } console.log(total);
Array[i]
let total = 0; for(let i = 0; i < iterations; ++i) { const index = indexes[i]; total += array[index]; } console.log(total);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.at(i)
Array[i]
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.at(i)
29675.2 Ops/sec
Array[i]
30832.0 Ops/sec
Related benchmarks:
loops-forin-forof-native-4
testArr insertion
sum array
This site broken
Array creation for, map, foreach
testing array ops
Array.at(i) vs Array[i]
Array timing
100 array
Comments
Confirm delete:
Do you really want to delete benchmark?