Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Chrome 104
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
_.isEqual 2020323.4 Ops/sec
JSON.stringify 1103266.6 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
 
window.foo = [
    'cat',
    'dog',
    'bird',
    {
        banana: {
            color: 'yellow'
        },
    },
];
window.bar = [{
        banana: {
            color: 'yellow'
        },
    },
    'cat',
    'dog',
    'bird',
];
Tests:
  • _.isEqual

     
    _.isEqual(window.foo, window.bar)
  • JSON.stringify

     
    JSON.stringify(window.foo) === JSON.stringify(window.bar);