Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Plain object check: Object.prototype.toString vs Object.getPrototypeOf
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
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Object.prototype.toString
16/s
Object.getPrototypeOf
15/s
View exact numbers
Test name
Executions per second
✓
Object.prototype.toString
16 Ops/sec
Object.getPrototypeOf
15 Ops/sec
Script Preparation code:
var PLAIN_OBJECT_PROTO = Object.getPrototypeOf({}) var obj = { 'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1 };
Tests:
Object.prototype.toString
for (let i=10000; i > 0; i--) { console.log(Object.prototype.toString.call(obj) === '[object Object]' ? 'P' : 'F'); }
Object.getPrototypeOf
for (let i=10000; i > 0; i--) { console.log(obj !== null && typeof obj === 'object' && Object.getPrototypeOf(obj) === PLAIN_OBJECT_PROTO ? 'P' : 'F') }