Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Underscore and Lodash: isEqual v3
(version: 0)
Comparing performance of:
Underscore equal vs Lodash equal vs Underscore none equal vs Lodash none equal
Created:
7 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.0/underscore-min.js'></script> <script type="text/javascript"> window.underscore = _; _ = null; </script> <script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.min.js'></script> <script type="text/javascript"> window.lodash = _; _ = null; </script>
Script Preparation code:
var obj1 = { 0: { 1: { key: 'one' } } }; var obj1copy = { 0: { 1: { key: 'one' } } }; var obj2 = { 0: { 1: { key: 'two' } } };
Tests:
Underscore equal
underscore.isEqual(obj1, obj1copy);
Lodash equal
lodash.isEqual(obj1, obj1copy);
Underscore none equal
underscore.isEqual(obj1, obj2);
Lodash none equal
lodash.isEqual(obj1, obj2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Underscore equal
Lodash equal
Underscore none equal
Lodash none equal
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.1:latest
, generated one year ago):
Let's dive into the benchmark results. **What is being tested?** The test cases are comparing the performance of two JavaScript libraries, Underscore.js and Lodash.js, when it comes to checking equality between objects using their respective `isEqual()` functions. **What options are compared?** There are four test cases: 1. **Underscore equal**: Checking if two identical objects (`obj1` and `obj1copy`) are equal using Underscore.js's `isEqual()` function. 2. **Lodash equal**: The same as above, but using Lodash.js's `isEqual()` function instead. 3. **Underscore none equal**: Checking if an object (`obj1`) is not equal to a different object (`obj2`) using Underscore.js's `isEqual()` function. 4. **Lodash none equal**: The same as above, but using Lodash.js's `isEqual()` function instead. **Pros and cons of the approaches:** Both Underscore.js and Lodash.js are popular utility libraries for JavaScript development. Here are some pros and cons to consider: * **Underscore.js**: + Pros: Lightweight, widely used, and well-maintained. + Cons: Not as feature-rich as Lodash.js, which might make it less suitable for complex use cases. * **Lodash.js**: + Pros: More feature-rich than Underscore.js, with additional functionality like currying, partials, and more. + Cons: Heavier library size compared to Underscore.js. **Other considerations:** When choosing between these two libraries, consider the following: * If you need a lightweight solution for simple use cases, Underscore.js might be sufficient. However, if your project requires additional features or is complex, Lodash.js might be a better fit. * Both libraries have active communities and are well-maintained. **Test case details:** The provided test cases are quite straightforward: 1. Two identical objects (`obj1` and `obj1copy`) are compared using both Underscore.js and Lodash.js's `isEqual()` functions. 2. An object (`obj1`) is compared against a different object (`obj2`) using both Underscore.js and Lodash.js's `isEqual()` functions. **Benchmark results:** The latest benchmark result shows the execution speed (Executions Per Second) for each test case on an iPhone running iOS 16.1 with Mobile Safari 16. The results are: * **Underscore equal**: 1688789.875 executions per second * **Underscore none equal**: 1537883.75 executions per second * **Lodash equal**: 699372.3125 executions per second * **Lodash none equal**: 667830.3125 executions per second These results suggest that Underscore.js's `isEqual()` function performs better than Lodash.js's when checking equality between identical objects, while Lodash.js might be faster for non-equal object comparisons. Keep in mind that these results are specific to the provided test cases and might not reflect real-world scenarios.
Related benchmarks:
Object comparison
Equals vs underscore vs lodash
Equals vs underscore vs lodash part 2
AsADqw
Comments
Confirm delete:
Do you really want to delete benchmark?