Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
instanceof vs nodetype
(version: 1)
Comparing performance of:
instanceof vs nodeType
Created:
2 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here--> <div id='test'></div>
Script Preparation code:
const node = document.getElementById("test")
Tests:
instanceof
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ console.assert(node instanceof HTMLElement === true)
nodeType
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ console.assert((node.nodeType === Node.ELEMENT_NODE) === true)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
instanceof
nodeType
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser/OS:
Chrome 145 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
instanceof
59853136.0 Ops/sec
nodeType
129584664.0 Ops/sec
Related benchmarks:
nodeType vs instanceof
nodeType vs instanceof 2
Object vs array performance
Object vs array performance 2
Object vs array performance 3
Instanceof vs property access
testaaaaa
Check if specified obj is DOM Node
looping through arrayLike
Comments
Confirm delete:
Do you really want to delete benchmark?