Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for vs reduce for object
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
reduce
16285097.0 Ops/sec
for
3357120.0 Ops/sec
Script Preparation code:
var gsmCells = [ { "countrycode": 250, "operatorid": 2, "lac": 9703, "cellid": 23446, "signal_strength": -75 }, { "countrycode": 250, "operatorid": 2, "lac": 9703, "cellid": 59141, "signal_strength": -76 }, { "countrycode": 250, "operatorid": 2, "lac": 9703, "cellid": 6924, "signal_strength": -80 }, { "countrycode": 250, "operatorid": 2, "lac": 9703, "cellid": 23449, "signal_strength": -81 } ];
Tests:
reduce
gsmCells.reduce((prev, curr) => prev.signal_strength > curr.signal_strength ? prev : curr );
for
let max = gsmCells[0]; for(let i = 0; i < gsmCells.length; i++){ if(gsmCells[i].signal_strength > max.signal_strength) max = gsmCells[i]; }