Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
find vs lookup
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/143.0.0.0 Safari/537.36
Browser:
Chrome 143
Operating system:
Windows
Device Platform:
Desktop
Date tested:
8 months ago
Benchmark engine:
Benchmark.js
lookup method
5.2M/s
find method
1.4M/s
View exact numbers
Test name
Executions per second
✓
lookup method
5,242,896 Ops/sec
find method
1,434,800 Ops/sec
Script Preparation code:
var arr = []; var i = 0; while (i <= 10) arr[i] = ('' + i++); var testSet = new Set(arr); var testObj = {}; for (const a of arr) { testObj[a] = true; } var randomKeys = []; i = 0; while (i <= 50) { randomKeys.push(''+Math.round(Math.random(50000) + 5000)); i++; }
Tests:
find method
for (const key of randomKeys) {const index = arr.find(item => item == key);}
lookup method
for (const key of randomKeys) {const index = testObj[key];}