Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
.prototype.isPrototypeOf vs .prototype.isPrototypeOf.bind vs Object.prototype.toString.call vs shorthand for Object.prototype.toString
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/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
.prototype.isPrototypeOf
897471.2 Ops/sec
.prototype.isPrototypeOf.bind
1287117.6 Ops/sec
Object.prototype.toString.call
257948.0 Ops/sec
shorthand for Object.prototype.toString
287005.7 Ops/sec
Script Preparation code:
var isPro = o => o.prototype.isPrototypeOf.bind(o.prototype), isRx = isPro(RegExp), objType = o => Object.prototype.toString.call(o).slice(8, -1), oPTS = Object.prototype.toString, objType2 = o => oPTS.call(o).slice(8, -1), arr = [0, 1, 2, "", /a/], noShortHand = a => typeof a === "string" ? 1 : RegExp.prototype.isPrototypeOf(a) ? 2 : 3, shortHand = a => typeof a === "string" ? 1 : isRx(a) ? 2 : 3, useObjType = a =>( t = objType(a), t === "String" ? 1 : t === "RegExp" ? 2 : 3 ), useObjType2 = a =>( t = objType2(a), t === "String" ? 1 : t === "RegExp" ? 2 : 3 );
Tests:
.prototype.isPrototypeOf
arr.forEach(e=>noShortHand(e));
.prototype.isPrototypeOf.bind
arr.forEach(e=>shortHand(e));
Object.prototype.toString.call
arr.forEach(e=>useObjType(e));
shorthand for Object.prototype.toString
arr.forEach(e=>useObjType2(e));