Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JSON Stringify vs Object Keys Properties in two objects comparison 2
Calculate what is the faster way to check if 2 objects have the same properties
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/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
JSON Stringify
1152866.6 Ops/sec
Object Keys
9330.1 Ops/sec
Script Preparation code:
var x = '{"driverId":"997002454332499322","firstName":"Bob","lastName":"Minnie Van 134","queuedRides":0,"pickupLocation":null,"dropOffLocation":null,"onlineStartTime":"6/8/2023 3:45:34 PM","rideId":null,"status":"Online"}'; var y = '{"driverId":"997002454332499322","firstName":"Bob","lastName":"Minnie Van 134","queuedRides":0,"pickupLocation":null,"dropOffLocation":null,"onlineStartTime":"6/8/2023 3:45:34 PM","rideId":null,"status":"Online"}';
Tests:
JSON Stringify
return JSON.stringify(x) === JSON.stringify(y);
Object Keys
for (key of Object.keys(x)) { if (x[key] !== y[key]) return false; } return true;