Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
t54 xxx
(version: 0)
Comparing performance of:
l map vs map vs l reduce vs reduce
Created:
7 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
const j = [ { 'user': 'barney', 'active': true, 'age': 27 }, { 'user': 'fred', 'active': false, 'age': 32 }, { 'user': 'greg', 'active': false, 'age': 42 }, { 'user': 'max', 'active': false, 'age': 2 }, { 'user': 'ellin', 'active': false, 'age': 102 } ] function lodashmap () { arr = _.map(j, function(el){ return el }) console.log(arr) } function jsmap () { arr = j.map(function(el){ return el }) console.log(arr) } function lodashreduce () { arr = _.reduce(j, (els, el) => { els.push(el) return els }, []) console.log(arr) } function jsreduce () { arr = j.reduce(function(els, el) { els.push(el) return els }, []) console.log(arr) }
Tests:
l map
lodashmap()
map
jsmap()
l reduce
lodashreduce()
reduce
jsreduce()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
l map
map
l reduce
reduce
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:
lodash map vs es6 map v2
_.map vs array.map
lodash map vs es6 Object.values.map
test123_123
Comments
Confirm delete:
Do you really want to delete benchmark?