Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
reduce vs reduceset
(version: 1)
Comparing performance of:
reduce vs pick
Created:
one year ago
by:
Guest
Go to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
reduce
const TEXT_PROPS_TO_BLOCK = [ 'display', 'textColor', 'verticalAlign', 'className', 'style', ]; const propsToTest = { "aria-label": "ordered list", "data-test": "something", "textColor": "foo", "className": "bar" } const newList = Object.keys(propsToTest).reduce((newObj, key) => { if (!TEXT_PROPS_TO_BLOCK.includes(key)) { newObj[key] = propsToTest[key]; } return newObj; }, {});
pick
const TEXT_PROPS_TO_BLOCK = [ 'display', 'textColor', 'verticalAlign', 'className', 'style', ]; const props = { "aria-label": "ordered list", "data-test": "something", "textColor": "foo", "className": "bar" } const BOX_PROPS_TO_BLOCK_SET = new Set(TEXT_PROPS_TO_BLOCK) const newList = Object.keys(props).reduce((newProps, key)=> { if (!BOX_PROPS_TO_BLOCK_SET.has(key)) { newProps[key] = props[key]; } return newProps; }, {});
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
reduce
pick
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser/OS:
Chrome 132 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
reduce
13.1M/s
pick
7.5M/s
View exact numbers
Test name
Executions per second
✓
reduce
13,133,803 Ops/sec
pick
7,503,051 Ops/sec
Related benchmarks
for in vs reduce vs pick
for in vs reduce vs pick vs filter
lodash map vs. native map
lodash vs es6 test
reduce vs reduceset2
Comments
Confirm delete:
Do you really want to delete benchmark?