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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
includes
175047.0 Ops/sec
forEach
103126.4 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; });