Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
__proto__ vs getPrototypeOf
(version: 0)
Comparing performance of:
__proto__ vs Object.getPrototypeOf vs Reflect.getPrototypeOf
Created:
2 years ago
by:
Registered User
Jump to the latest result
Tests:
__proto__
({}).__proto__
Object.getPrototypeOf
Object.getPrototypeOf({})
Reflect.getPrototypeOf
Reflect.getPrototypeOf({})
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
__proto__
Object.getPrototypeOf
Reflect.getPrototypeOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0
Browser/OS:
Firefox 135 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
__proto__
377286080.0 Ops/sec
Object.getPrototypeOf
214228976.0 Ops/sec
Reflect.getPrototypeOf
211665552.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Let's break down the provided benchmark and explain what's being tested. **Benchmark Overview** The benchmark compares three ways to access an object's prototype chain in JavaScript: `__proto__`, `Object.getPrototypeOf()`, and `Reflect.getPrototypeOf()`. **Options Compared** 1. **`__proto__`**: This is a legacy way of accessing an object's prototype chain using the `__proto__` property. 2. **`Object.getPrototypeOf()`**: This method was introduced in ECMAScript 2015 (ES6) to access an object's prototype chain. It returns a new `Prototype` object that represents the next level in the prototype chain of the original object. 3. **`Reflect.getPrototypeOf()`**: This is a newer way of accessing an object's prototype chain using the Reflect API, which was introduced in ECMAScript 2018 (ES9). It also returns a new `Prototype` object representing the next level in the prototype chain. **Pros and Cons** * **`__proto__`**: Pros: Widely supported, easy to understand. Cons: Not as explicit or modern as other options. * **`Object.getPrototypeOf()`**: Pros: Modern, explicit way of accessing the prototype chain. Cons: Only available since ES6, might require more effort for developers who haven't used it before. * **`Reflect.getPrototypeOf()`**: Pros: Newer, simpler syntax than `Object.getPrototypeOf()`, even easier to read and write. Cons: Still a relatively new API (introduced in ES9), not as widely supported yet. **Library Usage** None of the benchmark cases use external libraries; they all rely on built-in JavaScript features. **Special JS Feature or Syntax** All three options (`__proto__`, `Object.getPrototypeOf()`, and `Reflect.getPrototypeOf()`) utilize built-in JavaScript syntax, so there are no special features or syntaxes mentioned in this benchmark.
Related benchmarks:
Function: typeof vs instanceof
(instanceof Function) vs (typeof function)
typeof vs instanceof Function vs call
Check object. typeof vs constructor
instanceof vs typeof franco
Comments
Confirm delete:
Do you really want to delete benchmark?