Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash map vs js map (v4.17.21)
(version: 1)
Comparing performance of:
JS map vs lodash map vs js reduce vs lodash reduce
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js'></script>
Script Preparation code:
const j = [1, 4, 9, 16, 25, 35, 49, 68, 74, 86, 93, 110, 121, 135, 141, 156, 157, 158, 161, 162, 163, 164, 165, 166, 167, 168] function mapper(el) { return el + 10 } function lodashMap () { arr = _.map(j, mapper) console.log(arr) } function jsMap () { arr = j.map(mapper) console.log(arr) } function reducer (sum, el){ return sum + el } function lodashReduce () { sum = _.reduce(j, reducer, 0) console.log(sum) } function jsReduce () { sum = j.reduce(reducer, 0) console.log(sum) }
Tests:
JS map
jsMap()
lodash map
lodashMap()
js reduce
jsReduce()
lodash reduce
lodashReduce()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
JS map
lodash map
js reduce
lodash reduce
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Browser/OS:
Firefox 139 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
JS map
67144.2 Ops/sec
lodash map
64057.8 Ops/sec
js reduce
77174.3 Ops/sec
lodash reduce
76896.3 Ops/sec
Related benchmarks:
lodash map vs es6 map v2
t54 xxx
Moz lodash map vs es6 map
lodash map vs. vanilla map
lodash map vs js map
lodash map vs es6 Object.values.map
Lodash Object/Array map vs native
мвмывммвым
Complex mapping
Comments
Confirm delete:
Do you really want to delete benchmark?