Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
ApiListWrapper .find() implementations
Evaluate the pers performance of the .find method.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Browser:
Chrome 143
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
6 months ago
for..loop
104.3M/s
Array.find()
102.3M/s
Direct Array.find() pass
102.1M/s
Direct Array.find() call
98.7M/s
for..of
79.9M/s
View exact numbers
Test name
Executions per second
✓
for..loop
104,274,624 Ops/sec
Array.find()
102,333,568 Ops/sec
Direct Array.find() pass
102,091,776 Ops/sec
Direct Array.find() call
98,670,832 Ops/sec
for..of
79,927,968 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const users = ['Rui', 'Milad', 'Nils']; const lambdaFn = user => user.name === 'Nils';
Tests:
Array.find()
const findBy = (fn) => { users.find(item => lambdaFn(item)) ?? null; } findBy(lambdaFn);
for..of
const findBy = (fn) => { for (const user of users) { if (lambdaFn(user)) { return user; } } return null; } findBy(lambdaFn);
for..loop
const findBy = (fn) => { for (let i = 0; i < users.lengh; i++) { if (lambdaFn(users[i])) { return users[i]; } } return null; } findBy(lambdaFn);
Direct Array.find() pass
const findBy = (fn) => { users.find(lambdaFn) ?? null; } findBy(lambdaFn);
Direct Array.find() call
users.find(item => lambdaFn(item)) ?? null