Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
reduceArrayOfObject
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/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
reduceArrayOfObjectOld
194087.7 Ops/sec
reduceArrayOfObjectNew
172915.8 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const reduceArrayOfObjectOld = (list, key) => { if (!list) { throw new Error(`Empty list`); } if (!key) { throw new Error(`Empty key`); } const len = list.length; const result = new Array(len); for (let index = 0; index < len; index++) { result[index] = list[index][key]; } return result; }; const reduceArrayOfObjectNew = (list, key) => { if (!list) { throw new Error(`Empty list`); } if (!key) { throw new Error(`Empty key`); } const len = list.length; const result = new Array(len); let index = 0; for (; index < len; index++) { result[index] = list[index][key]; } return result; }; const DATA = new Array(1000).fill({a: 1});
Tests:
reduceArrayOfObjectOld
reduceArrayOfObjectOld(DATA, 'a')
reduceArrayOfObjectNew
reduceArrayOfObjectNew(DATA, 'a')