Test name | Executions per second |
---|---|
_.isEqual | 2125153.0 Ops/sec |
JSON.stringify | 1268931.0 Ops/sec |
Element comparision | 2284382.8 Ops/sec |
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
window.foo = ['cat', 'dog',];
window.bar = ['cat', 'dog',];
_.isEqual(window.foo, window.bar)
JSON.stringify(window.foo) === JSON.stringify(window.bar);
window.foo[0] === window.bar[0] && window.foo[1] === window.bar[1]