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
gemma2:9b
, generated one year ago):
This benchmark tests the performance of two popular JavaScript libraries, Underscore and Lodash, when comparing objects using their `isEqual` function. **Options Compared:** * **Underscore.isEqual(obj1, obj1copy);**: Compares two identical objects (`obj1` and `obj1copy`) to see how quickly Underscore determines they are equal. * **Lodash.isEqual(obj1, obj1copy);**: Does the same comparison as above, but using Lodash's `isEqual` function. * **Underscore.isEqual(obj1, obj2);**: Compares two different objects (`obj1` and `obj2`) to see how quickly Underscore identifies they are not equal. * **Lodash.isEqual(obj1, obj2);**: Does the same comparison as above, but using Lodash's `isEqual` function. **Pros/Cons:** * Both Underscore and Lodash are lightweight and efficient JavaScript libraries designed to simplify common tasks. Their `isEqual` function is optimized for quickly comparing objects and detecting differences. * Choosing between them often comes down to personal preference, existing project dependencies, or the specific features offered by each library. **Other Considerations:** * **Object Complexity**: The benchmark's simple objects make it a good starting point. Real-world comparisons might involve nested objects, arrays, functions, or other complex data structures, which could impact performance differences. * **Environment**: Execution speed can vary depending on the browser, JavaScript engine, and overall system resources. **Alternatives:** While Underscore and Lodash are popular choices, there are other libraries or approaches for object comparison: * **Native JavaScript `Object.is()`**: This method provides strict equality checks for objects, potentially being more performant than library functions in some cases. * **Manual Comparison**: For simple objects, you could write your own comparison logic using loops and conditional statements. However, this can be less efficient and error-prone than using established libraries. Let me know if you have any further questions or would like to explore specific aspects of the benchmark results!
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?