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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Safari/537.36 OPR/60.3.3004.55692
Browser:
Opera 60
Operating system:
Linux
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
JSON Stringify
45763.6 Ops/sec
Object Keys
1561.7 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;