Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Underscore and Lodash: isEqual v2.2
(version: 1)
Comparing performance of:
Underscore equal vs Lodash equal vs Underscore none equal vs Lodash none equal vs ES6 equal vs ES6 !euqal
Created:
7 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'></script> <script type="text/javascript"> window.underscore = _; _ = null; </script> <script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script> <script type="text/javascript"> window.lodash = _; _ = null; </script>
Script Preparation code:
var obj1 = { 'RecordTypeId': 'abc', 'GoldenRecordId__pc': 'abc', 'MDMExternalId__c': 'abc', 'KNR__pc': 'abc', 'LetterSalutation__pc': 'abc', 'Organization__c': 'abc', 'TitleOfNobility__pc': 'abc', 'AcademicTitle__pc': 'abc', 'FirstName': 'abc', 'LastName': 'abc', 'IsLegalPerson__c': 'abc', 'PersonBirthdate': 'abc', 'DeathOrInsolvencyDate__c': 'abc', 'IsRelevantForMarketingCloud__c': true, 'LatestContractOE__c': 'abc', 'PNRResponsible__pc': 'abc', 'LatestContractNumber__c': 'abc', 'BrokerLock__c': false, 'BrokerCustomer__c': false }; var obj1copy = { 'RecordTypeId': 'abc', 'GoldenRecordId__pc': 'abc', 'MDMExternalId__c': 'abc', 'KNR__pc': 'abc', 'LetterSalutation__pc': 'abc', 'Organization__c': 'abc', 'TitleOfNobility__pc': 'abc', 'AcademicTitle__pc': 'abc', 'FirstName': 'abc', 'LastName': 'abc', 'IsLegalPerson__c': 'abc', 'PersonBirthdate': 'abc', 'DeathOrInsolvencyDate__c': 'abc', 'IsRelevantForMarketingCloud__c': true, 'LatestContractOE__c': 'abc', 'PNRResponsible__pc': 'abc', 'LatestContractNumber__c': 'abc', 'BrokerLock__c': false, 'BrokerCustomer__c': false }; var obj2 = { 'RecordTypeId': 'abc', 'GoldenRecordId__pc': 'abc', 'MDMExternalId__c': 'abc', 'KNR__pc': 'abc', 'LetterSalutation__pc': 'abc', 'Organization__c': 'abc', 'TitleOfNobility__pc': 'abc', 'AcademicTitle__pc': 'abc', 'FirstName': 'abc', 'LastName': 'abc', 'IsLegalPerson__c': 'abc', 'PersonBirthdate': 'abc', 'DeathOrInsolvencyDate__c': 'abc', 'IsRelevantForMarketingCloud__c': true, 'LatestContractOE__c': 'abc', 'PNRResponsible__pc': 'abc', 'LatestContractNumber__c': 'abc', 'BrokerLock__c': false, 'BrokerCustomer__c': true };
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);
ES6 equal
Object.entries(obj1).toString() === Object.entries(obj1copy).toString();
ES6 !euqal
Object.entries(obj1).toString() === Object.entries(obj2).toString();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
Underscore equal
Lodash equal
Underscore none equal
Lodash none equal
ES6 equal
ES6 !euqal
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):
I'll break down the provided JSON and explain what's being tested. **Benchmark Definition** The benchmark is designed to compare the equality detection capabilities of two popular JavaScript libraries: Underscore.js and Lodash.js. The tests are created using JavaScript microbenchmarks, which allow for precise measurements of performance. **Script Preparation Code** The script preparation code sets up the test objects `obj1` and `obj2`. These objects contain identical data structures (`arrays`) that are used to compare equality between the two libraries. **Individual Test Cases** There are four test cases: 1. **Underscore equal**: Tests if both Underscore.js and Lodash.js correctly identify that `obj1` and `obj1copy` (a copy of `obj1`) are equal. 2. **Underscore none equal**: Tests if both Underscore.js and Lodash.js incorrectly identify that `obj1` and `obj2` are equal, when in fact they are not. 3. **Lodash equal**: Similar to the first test case, but uses Lodash.js instead of Underscore.js. 4. **Lodash none equal**: Similar to the second test case, but uses Lodash.js instead of Underscore.js. **ES6 Equal and ES6 !Equal** The last two test cases use the `Object.entries()` method to compare the equality of objects. These tests are designed to check if both libraries correctly handle object equality when using this specific method. **What's being tested?** In summary, these tests are verifying that: * Both Underscore.js and Lodash.js can correctly identify equal data structures. * Both libraries incorrectly identify equal non-equal data structures. * Both libraries can correctly handle object equality when using `Object.entries()`. The benchmark results show the execution rate of each test case for different browsers and devices. The faster execution times indicate that one library is more efficient than the other in specific scenarios.
Related benchmarks:
Lodash vs. Set Intersection vs Array intersection 3
test lodash vs js vanilla
Object, If, Ternary or Switch
Join vs loop
Comments
Confirm delete:
Do you really want to delete benchmark?