Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
reduce or forEach
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Browser:
Chrome 147
Operating system:
Linux
Device Platform:
Desktop
Date tested:
15 days ago
Test name
Executions per second
Reduce
8866247.0 Ops/sec
For Each
259364.9 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var a = Array.from({length:100},()=>Math.random()< 0.5 ? { igvTax: 0, subtotal: 100*Math.random()}: { igvTax: 1, subtotal: 100*Math.random()}); var b = 0;
Tests:
Reduce
b = a.reduce((acc, { subtotal, igvTax })=>{ if(!igvTax) return acc return acc += subtotal },0)
For Each
a.forEach(({ subtotal, igvTax }) => { if(!igvTax) return b += subtotal })