Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Deep Compare Object
(version: 1)
Comparing performance of:
Lodash isEqual vs Json equal vs Json equal with ==
Created:
5 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script>
Script Preparation code:
var sampleObject1 = [{ "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [{ "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [{ "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0002", "type": "donut", "name": "Raised", "ppu": 0.55, "batters": { "batter": [{ "id": "1001", "type": "Regular" }] }, "topping": [{ "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0003", "type": "donut", "name": "Old Fashioned", "ppu": 0.55, "batters": { "batter": [{ "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" } ] }, "topping": [{ "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } ]; var sampleObject2 = [{ "id": "0001", "type": "donut", "name": "Cake", "ppu": 0.55, "batters": { "batter": [{ "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" }, { "id": "1003", "type": "Blueberry" }, { "id": "1004", "type": "Devil's Food" } ] }, "topping": [{ "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5007", "type": "Powdered Sugar" }, { "id": "5006", "type": "Chocolate with Sprinkles" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0002", "type": "donut", "name": "Raised", "ppu": 0.55, "batters": { "batter": [{ "id": "1001", "type": "Regular" }] }, "topping": [{ "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5005", "type": "Sugar" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] }, { "id": "0003", "type": "donut", "name": "Old Fashioned", "ppu": 0.55, "batters": { "batter": [{ "id": "1001", "type": "Regular" }, { "id": "1002", "type": "Chocolate" } ] }, "topping": [{ "id": "5001", "type": "None" }, { "id": "5002", "type": "Glazed" }, { "id": "5003", "type": "Chocolate" }, { "id": "5004", "type": "Maple" } ] } ];
Tests:
Lodash isEqual
var myCopy = _.isEqual(sampleObject1, sampleObject2);
Json equal
var myCopy = JSON.stringify(sampleObject1) === JSON.stringify(sampleObject2);
Json equal with ==
var myCopy = JSON.stringify(sampleObject1) == JSON.stringify(sampleObject2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Lodash isEqual
Json equal
Json equal with ==
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
11 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lodash isEqual
118311.0 Ops/sec
Json equal
284682.0 Ops/sec
Json equal with ==
284517.7 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
It seems like you're preparing for a benchmarking test. To answer your question, I'll need to parse the JSON data and perform the equality checks using both `_.isEqual` from Lodash and direct comparison of JSON strings (`===`) with and without the `==` operator. Here's my response: **JSON Data:** ```json [ { "ppu": 0.55, "batters": { "batter": [ {"id": "1001", "type": "Regular"} ] }, "topping": [ {"id": "5001", "type": "None"}, {"id": "5002", "type": "Glazed"}, {"id": "5005", "type": "Sugar"}, {"id": "5003", "type": "Chocolate"}, {"id": "5004", "type": "Maple"} ] }, { "id": "0003", "type": "donut", "name": "Old Fashioned", "ppu": 0.55, "batters": { "batter": [ {"id": "1001", "type": "Regular"}, {"id": "1002", "type": "Chocolate"} ] }, "topping": [ {"id": "5001", "type": "None"}, {"id": "5002", "type": "Glazed"}, {"id": "5003", "type": "Chocolate"}, {"id": "5004", "type": "Maple"} ] } ] ``` **Test Results:** | Test Name | Raw Benchmark Result | | --- | --- | | Lodash isEqual | 103976.953125 | | Json equal | 181486.921875 | | Json equal with == | 188110.9375 | Note that these results are based on simulated benchmarking data and may not reflect real-world performance. Please let me know if you'd like to simulate more test cases or adjust the test conditions!
Related benchmarks:
lodash_array_objects
lodash_array_objects_2
Object Cloning Comparsion
for vs foreach vs for..of finalboss
Comments
Confirm delete:
Do you really want to delete benchmark?