Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.keys VS JSON.stringify() for empty objects and arrays
You don't need to make add for loops in your test scenarios, the benchmark does it itself.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 OPR/115.0.0.0 (Edition Yx 05)
Browser:
Opera 115
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.keys()
49670844.0 Ops/sec
JSON.stringify()
9316614.0 Ops/sec
Script Preparation code:
var obj = {} var arr = [];
Tests:
Object.keys()
Object.keys(arr) === 0 Object.keys(obj) === 0
JSON.stringify()
JSON.stringify(obj) === "{}" JSON.stringify(arr) === "[]"