Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash vs Ramda (2020-08 edition)
(version: 0)
Comparing performance of:
Lodash vs Ramda without relying on currying or composition vs Ramda with currying and composition
Created:
5 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.0/ramda.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.19/lodash.js"></script>
Script Preparation code:
var data = _.range(10000).map(function(i) { return { counter: i } }); function isOdd(num) { return num % 2 === 1; } function square(num) { return num * num; } function lessThanThreeDigits(num) { return num.toString().length < 3; }
Tests:
Lodash
var result = _.chain(data) .map(item => item.counter) .filter(isOdd) .map(square) .filter(lessThanThreeDigits) .value();
Ramda without relying on currying or composition
var result = R.filter(lessThanThreeDigits, R.map(square, R.filter(isOdd, R.pluck('counter', data))));
Ramda with currying and composition
var result = R.pipe( R.pluck('counter'), R.filter(isOdd), R.map(square), R.filter(lessThanThreeDigits) )(data);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Lodash
Ramda without relying on currying or composition
Ramda with currying and composition
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):
Let's break down what's being tested in this benchmark. **Benchmark Overview** The benchmark compares the performance of Lodash and Ramda, two popular JavaScript libraries for functional programming, on a specific test case involving data filtering and transformation. **Test Case** The test case involves creating an array of 10,000 objects with a `counter` property, then applying several transformations to this data using both Lodash and Ramda. The transformations include: 1. Filtering out odd numbers (`isOdd(num)` function) 2. Squaring the remaining numbers (`square(num)` function) 3. Checking if the squared number has less than 3 digits (`lessThanThreeDigits(num)` function) **Options being compared** The benchmark compares three different approaches to applying these transformations using Ramda: 1. **Ramda without relying on currying or composition**: This approach uses standalone functions, such as `R.filter`, `R.map`, and `R.pluck`, to apply the transformations. 2. **Ramda with currying and composition**: This approach uses functional programming concepts like currying (transforming a function that takes multiple arguments into one that takes an array of arguments) and composition (applying functions in sequence). The transformations are applied using piped functions, such as `R.pipe`. 3. **Lodash**: The benchmark also compares the performance of Lodash's `chain` method to apply the transformations. **Pros and Cons** Here are some pros and cons of each approach: 1. **Ramda without relying on currying or composition**: * Pros: More familiar, easier to read for those not familiar with functional programming. * Cons: Less efficient than piped functions. 2. **Ramda with currying and composition**: * Pros: More concise, can be more expressive and readable. * Cons: Requires a good understanding of functional programming concepts. 3. **Lodash**: * Pros: Familiar for those already using Lodash. * Cons: May not be as efficient as Ramda's piped functions. **Library explanations** 1. **Ramda**: A functional programming library that provides a set of higher-order functions (functions that take other functions as arguments) to manipulate and transform data. 2. **Lodash**: A utility library that provides a large collection of helper functions for common tasks, such as array manipulation, string manipulation, and more. **Special JS feature or syntax** This benchmark does not use any special JavaScript features or syntax beyond what's available in modern JavaScript implementations.
Related benchmarks:
Ramda vs. Lodash 3
Ramda vs. Lodash updated
Ramda vs. Lodash updated again
Ramda vs. Lodash 2021
Ramda vs. Lodash 2021 v2
Comments
Confirm delete:
Do you really want to delete benchmark?