Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.every vs JSON.stringify vs foreach
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
JSON.stringify
1778861.0 Ops/sec
Array.every
1385847.8 Ops/sec
foreach
1603334.1 Ops/sec
Script Preparation code:
window.foo = ['cat', 'dog', 'bird']; window.bar = ['cat', 'dog', 'bird'];
Tests:
JSON.stringify
JSON.stringify(window.foo) === JSON.stringify(window.bar);
Array.every
window.foo.every((item, index) => item === window.bar[index])
foreach
window.foo.forEach(f => window.bar.indexOf(f) != -1)