Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Includes vs forEach
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/131.0.6778.73 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 131
Operating system:
iOS 17.6.1
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
includes
35278.6 Ops/sec
forEach
24375.6 Ops/sec
Script Preparation code:
var arr1 = Array.from(Array(100).keys(), x => ({ value: x, disabled: false })); var arr2 = Array.from(Array(50).keys(), x => x * 2);
Tests:
includes
arr1.map(x => { if (arr2.includes(x.value)) x.disabled = true; return x; });
forEach
arr1.map(x => { arr2.forEach(y => { if (x.value === y) x.disabled = true; }); return x; });