Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
FilterMap vs Map
(version: 0)
Comparing performance of:
Map vs FilterMap
Created:
5 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var obj = { messages: [ { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": true, "message": "testing this message", "other_prop": null, "type": "customer_message" }, { "read": false, "message": "testing this message", "other_prop": null, "type": "customer_message" } ] }
Tests:
Map
let newObj = { messages: []}; newObj.messages = Object.assign([], obj.messages.map(m => { return m.read ? m : Object.assign({}, m, { read: true });}));
FilterMap
let newObj = { messages: []}; newObj.messages = Object.assign([], obj.messages.filter(m => {return m.read === false}).map(m => { return m.read ? m : Object.assign({}, m, { read: true });}));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Map
FilterMap
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Filter-Map: Lodash vs Native
Lodash Vs Native JS
native lodash filter map
native lodash filter map 2
Filter-Map: Lodash vs Native v3
Comments
Confirm delete:
Do you really want to delete benchmark?