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:
3 months ago
Test name
Executions per second
Array.find()
102333568.0 Ops/sec
for..of
79927968.0 Ops/sec
for..loop
104274624.0 Ops/sec
Direct Array.find() pass
102091776.0 Ops/sec
Direct Array.find() call
98670832.0 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