Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash flatten vs array.flat 2
(version: 1)
lodash flatten vs spread
Comparing performance of:
arr .flat vs lodash flatten vs concat + spread
Created:
8 months ago
by:
Guest
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 arr = new Array(3000).fill(new Array(100).fill("foo"));
Tests:
arr .flat
const flattened = arr.flat();
lodash flatten
const flattened = _.flatten(arr);
concat + spread
const flattened = [].concat(...arr);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
arr .flat
lodash flatten
concat + spread
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
8 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Browser/OS:
Chrome 140 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
arr .flat
273.0 Ops/sec
lodash flatten
483.2 Ops/sec
concat + spread
2164.7 Ops/sec
Related benchmarks:
lodash flatten vs array.flat
Lodash flatten vs nativate flat (depth 1)
Array.flat vs (reduce + concat) vs (reduce + destructure) vs (reduce + push) vs lodash.flatten
Array.flat vs (reduce + concat) vs (reduce + destructure) vs (reduce + push) vs lodash.flatten vs destructuring
Array.flat vs (reduce + concat) vs (reduce + destructure) vs (reduce + push) vs lodash.flatten vs destructuring 2
Flatten vs conat
lodash flatten vs concat
Lodash flattern vs flat
lodash flatten vs array.flat231
Comments
Confirm delete:
Do you really want to delete benchmark?