Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
compare arrays
lodash vs json stringify and other methods
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
_.isEqual
717834.2 Ops/sec
JSON.stringify
546973.4 Ops/sec
equals
978523.6 Ops/sec
equalsIgnoreOrder
485521.6 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
window.foo = ['cat', 'dog', 'bird']; window.bar = ['cat', 'dog', 'bird']; window.equals = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]); window.equalsIgnoreOrder = (a, b) => { if (a.length !== b.length) return false; const uniqueValues = new Set([...a, ...b]); for (const v of uniqueValues) { const aCount = a.filter(e => e === v).length; const bCount = b.filter(e => e === v).length; if (aCount !== bCount) return false; } return true; }
Tests:
_.isEqual
_.isEqual(window.foo, window.bar)
JSON.stringify
JSON.stringify(window.foo) === JSON.stringify(window.bar);
equals
window.equals(window.foo, window.bar)
equalsIgnoreOrder
window.equalsIgnoreOrder(window.foo, window.bar)