Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
findIndex vs indexOf - JavaScript performance with objects
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
findIndex
81931.7 Ops/sec
indexOf
6748704.0 Ops/sec
Script Preparation code:
let arr = new Array(15000); arr.fill({ id: 0, stuff: "stuff" }); arr = arr.map((el, idx) => ({ ...el, id: idx })); let foo = arr.find((el) => el.id === Math.floor(Math.random() * 15000));
Tests:
findIndex
let index = arr.findIndex((el) => el === foo);
indexOf
let index = arr.indexOf(foo);