Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.assign vs defineProperties vs setPrototypeOf vs extends Function vs defineProperty
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.assign
856100.0 Ops/sec
defineProperties
1787984.0 Ops/sec
setPrototypeOf
417894.2 Ops/sec
extends Function
1156443.9 Ops/sec
defineProperty
1749860.2 Ops/sec
Tests:
Object.assign
let f = ()=>0 Object.assign(f, { _foo: null, get foo() {return this._foo}, set foo(_foo) {this._foo = _foo}, })
defineProperties
let f = ()=>0 Object.defineProperties(f, { foo: { value: null, writable: true } })
setPrototypeOf
let f = ()=>0 Object.setPrototypeOf(f, { ...Function.prototype, _foo: null, get foo() {return this._foo}, set foo(_foo) {this._foo = _foo}, })
extends Function
class F extends Function { constructor() { super('return 0') } _foo = null get foo() {return this._foo} set foo(_foo) {this._foo = _foo} }
defineProperty
let f = ()=>0 f._foo = null Object.defineProperty(f, 'foo', { get() { return this._foo }, set(_foo) { this._foo = _foo } })