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/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
test truth
86085808.0 Ops/sec
test undefined
6776846.5 Ops/sec
test hasOwnProperty
47493084.0 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; }