Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Testing for false vs === undefined vs hasOwnProperty for undefined member
Is there a performance benefit to replacing === undefined with a logical test?
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/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
test truth
154.0M/s
test hasOwnProperty
79.3M/s
test undefined
9.9M/s
View exact numbers
Test name
Executions per second
✓
test truth
153,968,432 Ops/sec
test hasOwnProperty
79,274,776 Ops/sec
test undefined
9,948,437 Ops/sec
Tests:
test truth
var n = {}; while(true) { if(!n.foo) break; }
test undefined
var n = {}; while(true) { if(n.foo===undefined) break; }
test hasOwnProperty
var n = {}; while(true) { if(!n.hasOwnProperty('foo')) break; }