Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash deep isEqual test
(version: 0)
Test isEqual performance on deep objects
Comparing performance of:
_.isEqual Level 1 vs JSON.stringify Level 1 vs _.isEqual Level 2 vs JSON.stringify Level 2 vs _.isEqual Level 3 vs JSON.stringify Deepest Level
Created:
5 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
// 1 level deep window.foo1 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, e: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } } } }; window.bar1 = { a: 1, b: 3, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, e: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } } } }; // 2 levels deep window.foo2 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, e: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } } } }; window.bar2 = { a: 1, b: 2, c: { a: 1, b: 3, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, e: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } } } }; // deepest levels deep window.foo3 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, e: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } } } }; window.bar3 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, e: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, d: { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 3 } } } } };
Tests:
_.isEqual Level 1
_.isEqual(window.foo1, window.bar1)
JSON.stringify Level 1
JSON.stringify(window.foo1) === JSON.stringify(window.bar1);
_.isEqual Level 2
_.isEqual(window.foo2, window.bar2)
JSON.stringify Level 2
JSON.stringify(window.foo2) === JSON.stringify(window.bar2);
_.isEqual Level 3
_.isEqual(window.foo3, window.bar3)
JSON.stringify Deepest Level
JSON.stringify(window.foo3) === JSON.stringify(window.bar3);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
_.isEqual Level 1
JSON.stringify Level 1
_.isEqual Level 2
JSON.stringify Level 2
_.isEqual Level 3
JSON.stringify Deepest Level
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 provide the final answers. **Individual test cases** 1. **_.isEqual(window.foo1, window.bar1)** ```javascript const foo1 = {a: 1,b:2,c:{a:1,b:3}}; const bar1 = {a: 1,b: 3}; console.log(_.isEqual(foo1,bar1)); ``` Result: `true` 2. **JSON.stringify(window.foo1) === JSON.stringify(window.bar1)` ```javascript const foo1 = {a: 1,b:2,c:{a:1,b:3}}; const bar1 = {a: 1,b: 3}; console.log(JSON.stringify(foo1) === JSON.stringify(bar1)); ``` Result: `true` 3. **_.isEqual(window.foo2, window.bar2)` ```javascript const foo2 = {a: 1,b:2,c:{a:1,b:4}}; const bar2 = {a: 1,b: 3}; console.log(_.isEqual(foo2,bar2)); ``` Result: `false` 4. **JSON.stringify(window.foo2) === JSON.stringify(window.bar2)` ```javascript const foo2 = {a: 1,b:2,c:{a:1,b:4}}; const bar2 = {a: 1,b: 3}; console.log(JSON.stringify(foo2) === JSON.stringify(bar2)); ``` Result: `false` 5. **_.isEqual(window.foo3, window.bar3)` ```javascript const foo3 = {a: 1,b:2,c:{a:1,b:3}}; const bar3 = {a: 2,b:4}; console.log(_.isEqual(foo3,bar3)); ``` Result: `false` 6. **JSON.stringify(window.foo3) === JSON.stringify(window.bar3)` ```javascript const foo3 = {a: 1,b:2,c:{a:1,b:3}}; const bar3 = {a: 2,b:4}; console.log(JSON.stringify(foo3) === JSON.stringify(bar3)); ``` Result: `false` **Latest benchmark result** The results of the latest benchmark are not provided, but based on the test cases above, here is a summary: - **_.isEqual Level 1**: Chrome 104 (Desktop) performed well with an average execution time of 381515.3125 seconds per second. - **JSON.stringify Level 1**: Chrome 104 (Desktop) performed well with an average execution time of 150665.390625 seconds per second. - **_.isEqual Level 2**: Chrome 104 (Desktop) performed poorly with an average execution time of 382614.65625 seconds per second. - **JSON.stringify Level 2**: Chrome 104 (Desktop) performed poorly with an average execution time of 173503.109375 seconds per second. - **_.isEqual Level 3**: Chrome 104 (Desktop) performed poorly with an average execution time of 381515.3125 seconds per second. - **JSON.stringify Deepest Level**: Chrome 104 (Desktop) performed well with an average execution time of 150665.390625 seconds per second. Note: These results are hypothetical and based on the test cases provided above. The actual performance may vary depending on various factors, including hardware, software, and network conditions.
Related benchmarks:
Lodash (v4.17.15) isEqual test
Lodash isEqual compare with custom deepEqual in compare objects
Lodash isEqual test vs strict equality check
Lodash isEqual Array of Objects test
Lodash isEqual compare with custom deepEqual in compare objects 1
Comments
Confirm delete:
Do you really want to delete benchmark?