Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
typeof vs instanceof vs constructor equality check
Comparing typeof vs instanceof vs .constructor property
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Browser:
Firefox 142
Operating system:
Linux
Device Platform:
Desktop
Date tested:
8 months ago
Test name
Executions per second
instanceof check
139153.1 Ops/sec
constructor check
2111760.2 Ops/sec
Script Preparation code:
function Ticket(id) { this._id = id; } var testTicket = new Ticket(1); var count = 1000;
Tests:
instanceof check
for (var i = 0; i < count; i += 1) { if (testTicket instanceof Ticket) { continue; } }
constructor check
for (var i = 0; i < count; i += 1) { if (testTicket.constructor === Ticket) { continue; } }