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 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Browser:
Firefox 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
reduce
55811968.0 Ops/sec
for
134624032.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]; }