Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Find Object ID vs IndexOf int
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
IndexOf
495771.6 Ops/sec
find
1696.4 Ops/sec
Script Preparation code:
var indices = []; var objects = []; for (var i = 0; i < 10000; i++) { var idx = Math.floor(Math.random() * 1000); indices.push(idx) objects.push({ index: idx }); } var idx = Math.floor(Math.random() * 1000);
Tests:
IndexOf
var tempResult = indices.indexOf(idx);
find
var tempResult = objects.find(v => v.index === idx);