Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
indexOf/findIndex
(version: 0)
performance of indexOf vs findIndex for 'larger' objects
Comparing performance of:
findeIndex vs indexOf
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = new Array(15000); arr.fill({ id: 0, name='joseph', age: 20, children: 5, alien: false, createdAt: '2024-1-1', height: '180cm' }); arr = arr.map((el, idx) => el.id = idx); var foo = Math.floor(Math.random() * 15000); var bar = arr[foo]
Tests:
findeIndex
var index = arr.findIndex((num) => num === foo);
indexOf
var index = arr.indexOf(bar);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
findeIndex
indexOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?