Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
ramda, lodash and ecmaS
(version: 0)
check this out
Comparing performance of:
Ramda vs lodash vs EcmaS
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.27.0/ramda.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.fp.js"></script>
Script Preparation code:
var numbers = Array(100).fill().map((item, index) => index + 1); var isEven = number => number % 2 === 0;
Tests:
Ramda
R.pipe(R.filter(isEven), R.map(x => x + 1))(numbers);
lodash
_.flow(_.filter(isEven),_.map(x => x + 1))(numbers);
EcmaS
numbers.filter(isEven).map(isEven);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Ramda
lodash
EcmaS
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Ramda
3288869.2 Ops/sec
lodash
344673.5 Ops/sec
EcmaS
4957405.5 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the benchmark and explain what's being tested. **Benchmark Description** The benchmark is designed to test the performance of three different JavaScript libraries: Ramda, Lodash, and EcmaScript (ES). The benchmark consists of two parts: 1. Script Preparation Code: This code creates an array of 100 numbers and defines a simple function `isEven` that checks if a number is even. 2. Html Preparation Code: These are the HTML scripts that load the Ramda and Lodash libraries. **Test Cases** The benchmark has three test cases, each testing one of the three libraries: 1. **Ramda**: The benchmark uses the Ramda library's `pipe` function to filter the array of numbers for even values, add 1 to each remaining value, and then pipes it through another `map` function. 2. **Lodash**: The benchmark uses the Lodash library's `flow` function to chain together two functions: filtering the array of numbers for even values using `_filter`, and adding 1 to each remaining value using `_map`. 3. **EcmaScript (ES)**: The benchmark uses a simple ES expression to filter the array of numbers for even values, add 1 to each remaining value, without any additional library. **Options Compared** The three test cases are comparing the performance of: * Ramda's `pipe` function vs. Lodash's `flow` function vs. plain ES code **Pros and Cons** Here are some pros and cons for each approach: * **Ramda's pipe**: Pros: + More concise and readable syntax + Can be more efficient due to the ability to compose functions together Cons: + May require more overhead in terms of function creation and lookup * **Lodash's flow**: Pros: + Similar benefits to Ramda's `pipe` as above + Has built-in support for many common operations (e.g., `_map`, `_filter`) Cons: + Can be slower due to the added overhead of function calls + May require more memory due to the creation of intermediate functions * **Plain ES code**: Pros: + Lightweight and minimalistic, with no additional library dependencies Cons: + Requires more manual effort and readability may suffer **Library Use** Both Ramda and Lodash are functional programming libraries that aim to simplify and accelerate common operations. They provide a higher-order approach to programming, where functions are composed together using function pipes. In the benchmark, both libraries are used for their filtering and mapping capabilities, which are essential for the test cases. **Special JS Feature/Syntax** None of the test cases use any special JavaScript features or syntax that's not widely supported. The focus is on the performance difference between Ramda, Lodash, and plain ES code. **Alternatives** If you're looking for alternative libraries or approaches, here are a few options: * For filtering and mapping: `Array.prototype.filter` and `Array.prototype.map` (ES built-ins) * For functional programming: Other libraries like Svelte or Elm * For concise syntax: Other functions composed together using closures or higher-order functions Keep in mind that the choice of library or approach ultimately depends on your specific use case, performance requirements, and personal preference.
Related benchmarks:
Map (Native vs Ramda vs Lodash vs Immutable) with lambda function
Ramda pipe vs lodash flow
lodash flow vs ramdajs pipe
lodash chain vs ramdajs pipe
Comments
Confirm delete:
Do you really want to delete benchmark?