Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash FP vs. Ramda (fork)
(version: 0)
Comparing performance of:
Ramda.filter vs Lodash.filter vs Ramda.map vs Lodash.map vs Ramda.sortBy vs Lodash.sortBy vs Native Filter vs Native Map
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/ramda@0.26.1/dist/ramda.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.fp.min.js"></script>
Script Preparation code:
// var array = Array(100).fill().map(Math.random); var array = [0.9017467706848585,0.21272564120328719,0.6962267619498075,0.6422277838711532,0.9593646394969273,0.384545707843011,0.9621549107377982,0.3310154380805628,0.5888331288848434,0.6021934672232572,0.3867214245632906,0.44002551285037295,0.7844416925009745,0.4683798326064532,0.09530742807118653,0.9494980110682019,0.5517627476737859,0.27075531846293566,0.6368142865072488,0.09941470583217682,0.933486501012984,0.4985221065955707,0.41904389585011526,0.923596140305686,0.5228002084782135,0.6077779467188327,0.42320840902905843,0.731232440539773,0.9307780531862417,0.29836024021648444,0.554579757093159,0.4053992807493627,0.16091630002749158,0.7705124075175338,0.9608223557179418,0.4394781888577608,0.01095432401863472,0.03136616679676041,0.6997676761412202,0.8588471864228564,0.8832188299348112,0.30846541709664077,0.36841129639164527,0.6844774184833411,0.9170193800972171,0.8570589565501101,0.9903224465308713,0.46032265724049126,0.5709604148146583,0.0001866705452648887,0.5168371304925241,0.13473327748744635,0.5859259608223231,0.5700380981079469,0.9893382756645077,0.9439062611356868,0.25842777584107135,0.5175197385104873,0.8277673822532123,0.16940444558441392,0.9629376000774428,0.7036197679062814,0.05362073290108893,0.011749950514384988,0.461644467239795,0.5679559578600983,0.005852925686180566,0.25155196362153487,0.23808044097825154,0.7301283807008514,0.4721677297582094,0.8140865649653599,0.4171062433916495,0.7387615337866364,0.2049969302657242,0.8503063101238413,0.6927389337217917,0.5935962195783708,0.6749398160799638,0.5016852297473815,0.5741557769313446,0.48198287652961147,0.1864714353069341,0.3902550000789753,0.6095121876925051,0.45837885640334997,0.3455932965299935,0.6084466832174058,0.26804226969749556,0.7079598206946047,0.8858262390845866,0.16575163490735023,0.6046967890110588,0.7853141397533452,0.6680692400578638,0.6944725307476995,0.9711447815982044,0.3973398417805829,0.8772853006110772,0.9056997760024414];
Tests:
Ramda.filter
R.filter(Math.round, array);
Lodash.filter
_.filter(Math.round, array);
Ramda.map
R.map(Math.round, array);
Lodash.map
_.map(Math.round, array);
Ramda.sortBy
R.sortBy(val => val, array);
Lodash.sortBy
_.sortBy(val => val, array);
Native Filter
array.filter(Math.round)
Native Map
array.map(Math.round)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (8)
Previous results
Fork
Test case name
Result
Ramda.filter
Lodash.filter
Ramda.map
Lodash.map
Ramda.sortBy
Lodash.sortBy
Native Filter
Native Map
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!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
The benchmark results show the performance of various JavaScript libraries for common array operations: `filter`, `map`, and `sortBy`. **Comparison of Library Performance:** 1. **Native Filter:** 235.40 seconds/second 2. **Ramda.filter:** 240.47 seconds/second (slightly slower than native) 3. **Lodash.filter:** 519.99 seconds/second (much slower than native and Ramda) It appears that using the native JavaScript `filter` method is the fastest way to perform array filtering. **Comparison of Map Performance:** 1. **Native Map:** 105.45 seconds/second 2. **Ramda.map:** 438.24 seconds/second (slightly slower than native) 3. **Lodash.map:** 240.47 seconds/second (similar to Ramda) The results suggest that using the native JavaScript `map` method is still the fastest way to perform array mapping. **Comparison of SortBy Performance:** 1. **Ramda.sortBy:** 159.78 seconds/second 2. **Lodash.sortBy:** 605.94 seconds/second (much slower than Ramda) The benchmark results indicate that using Ramda's `sortBy` method is significantly faster than Lodash's implementation. **Conclusion:** When it comes to array operations, the native JavaScript methods (`filter`, `map`, and `sortBy`) tend to be the fastest options. Using external libraries like Ramda or Lodash may not provide significant performance benefits for these specific use cases. However, if you're already using one of these libraries in your project, they can still simplify your code and make it more readable.
Related benchmarks:
Lodash FP vs. Ramda
Ramda vs Lodash FP composed map filter sortBy
Lodash => (Equal + sort) vs (xor): unsorted array
Map (Native vs Ramda vs Lodash) latest 2021-01-18
Comments
Confirm delete:
Do you really want to delete benchmark?