HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
x
 
// 1 level deep
window.foo1 = { 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 } } };
// 2 levels deep
window.foo2 = { 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 } } };
// 3 levels deep
window.foo3 = { 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: 4 } } };
// same 
window.foo4 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } };
window.bar4 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } };
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 Level 3

     
    JSON.stringify(window.foo3) === JSON.stringify(window.bar3);
  • _.isEqual Level 4

     
    _.isEqual(window.foo4, window.bar4);
  • JSON.stringify Level 4

     
    JSON.stringify(window.foo4) === JSON.stringify(window.bar4);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    _.isEqual Level 1
    JSON.stringify Level 1
    _.isEqual Level 2
    JSON.stringify Level 2
    _.isEqual Level 3
    JSON.stringify Level 3
    _.isEqual Level 4
    JSON.stringify Level 4

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15
Safari 13 on Mac OS X 10.15.2
View result in a separate tab
Test name Executions per second
_.isEqual Level 1 740492.0 Ops/sec
JSON.stringify Level 1 386676.5 Ops/sec
_.isEqual Level 2 465469.3 Ops/sec
JSON.stringify Level 2 387518.0 Ops/sec
_.isEqual Level 3 333986.2 Ops/sec
JSON.stringify Level 3 395726.3 Ops/sec
_.isEqual Level 4 322794.0 Ops/sec
JSON.stringify Level 4 398255.2 Ops/sec