Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36
Chrome 90
Linux
Desktop
3 years ago
Test name Executions per second
_.isEqual 2125153.0 Ops/sec
JSON.stringify 1268931.0 Ops/sec
Element comparision 2284382.8 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',];
window.bar = ['cat', 'dog',];
Tests:
  • _.isEqual

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

     
    JSON.stringify(window.foo) === JSON.stringify(window.bar);
  • Element comparision

     
    window.foo[0] === window.bar[0] && window.foo[1] === window.bar[1]