Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test concat vs flatter in loop etc
(version: 0)
Comparing performance of:
Map vs Concat vs Chain vs Push with end flatten
Created:
8 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.min.js"></script>
Script Preparation code:
var arr = []; for (var i = 0; i < 10000; i++) { arr.push(() => [i]); };
Tests:
Map
let nodesFoundByClassName = _.flatten(_.map(arr, (el) => el()));
Concat
let nodesFoundByClassName = []; for (let i = 0, len = arr.length; i < len; i++) nodesFoundByClassName = nodesFoundByClassName.concat(arr[i]());
Chain
let nodesFoundByClassName = _(arr).map(arr, (el) => el()).flatten().value();
Push with end flatten
let nodesFoundByClassName = []; for (let i = 0, len = arr.length; i < len; i++) nodesFoundByClassName.push(arr[i]()); nodesFoundByClassName = _.flatten(nodesFoundByClassName);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Map
Concat
Chain
Push with end flatten
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:
native vs lodash
Lodash _concat vs native concat
lodash vs es6 in concat method
Flatten vs conat
concat vs lodash.concat vs. push.apply vs. spread operator vs. push in for loop v4
Comments
Confirm delete:
Do you really want to delete benchmark?