Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash vs radash 3
(version: 1)
test
Comparing performance of:
Optional vs lodash vs radash
Created:
2 years ago
by:
Registered User
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 src="https://cdnjs.cloudflare.com/ajax/libs/radash/12.1.0/radash.min.js" integrity="sha512-JEUqDJrck58H46FvJVzwvDWVlVEF83BkaG8/fagfTApgdo8ERV+Hqx4t7rDyFN8JGv84+r+WNoq9oZsgi5Glhw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Script Preparation code:
var obj = {a: {b: {c: {d: 1}}}} var badObj = {}
Tests:
Optional
var c = obj.a == null ? undefined : obj.a.b == null ? undefined : obj.a.b.c == null ? undefined : obj.a.b.c.d c == null ? 2 : c var d = badObj.a == null ? undefined : badObj.a.b == null ? undefined : badObj.a.b.c == null ? undefined : badObj.a.b.c.d d == null ? 2 : d
lodash
_.get(obj, "a.b.c.d", 2) _.get(badObj, "a.b.c.d", 2)
radash
radash.get(obj, "a.b.c.d", 2) radash.get(badObj, "a.b.c.d", 2)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Optional
lodash
radash
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Browser/OS:
Chrome 146 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Optional
165866176.0 Ops/sec
lodash
6419873.0 Ops/sec
radash
4011764.5 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the benchmark and its test cases. **Benchmark Definition** The benchmark is comparing two JavaScript libraries, Lodash (also known as "lodash") and Radash (also known as "radash"). The benchmark definition json provides information about the script preparation code, which sets up two objects: `obj` and `badObj`. `obj` is a nested object with multiple levels of properties, while `badObj` is an empty object. **Options Compared** The two libraries being compared are: 1. Lodash (`_.get()`) 2. Radash (`radash.get()`) These functions are used to access the value of a nested property in both objects. The benchmark definition provides the exact code snippets for each library, which allows users to run the same test cases with different libraries. **Pros and Cons** * **Lodash (.get())**: + Pros: Lodash is a widely-used and well-maintained library with a large community of contributors. Its `.get()` function is optimized for performance and is often used in production code. + Cons: Adding another dependency to the project, as users need to include the Lodash library in their build process. * **Radash (radash.get())**: + Pros: Radash is a lightweight alternative to Lodash, which can be beneficial for smaller projects or projects with performance constraints. Its `get()` function is also well-optimized and efficient. + Cons: Smaller community compared to Lodash, which may result in fewer resources available for troubleshooting and support. **Other Considerations** * **ES6 Syntax**: The benchmark definition uses modern JavaScript syntax, including arrow functions (`=>`) and template literals (`\``). This means that users need to be comfortable with ES6 syntax to run the benchmark. * **Browser Support**: The benchmark is executed in a Chrome browser (version 127), which may not cover all possible browsers or platforms. **Libraries** * **Lodash**: Lodash is a popular JavaScript utility library that provides a wide range of functions for tasks such as: + Array manipulation + Object manipulation + String manipulation + Function manipulation + And more... * **Radash**: Radash is a lightweight alternative to Lodash, providing similar functionality with a smaller footprint. It aims to be a faster and more efficient alternative to Lodash. **Special JS Features/Syntax** None mentioned in the benchmark definition. **Alternatives** If you're looking for alternatives to Lodash or Radash, here are some popular options: * **Underscore.js**: Another widely-used JavaScript utility library that provides similar functionality to Lodash. * **Lo-Dash**: A fast and efficient alternative to Lodash, with a smaller footprint. * **Immutable.js**: A library that focuses on functional programming and immutability, providing a different approach to data manipulation. Keep in mind that each library has its strengths and weaknesses, and the choice of which one to use depends on your specific project requirements and constraints.
Related benchmarks:
hasVshasOwnProperty
isEmpty vs. vanilla
Lodash.get vs native [Krosnoz]
lodash uniq vs Array.from(new Set()) vs spread new Set() vs array.filter vs radash _bigger
Comments
Confirm delete:
Do you really want to delete benchmark?