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 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0
Browser:
Firefox 134
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.assign
2370505.8 Ops/sec
defineProperties
5406805.5 Ops/sec
setPrototypeOf
1162344.0 Ops/sec
extends Function
2970618.0 Ops/sec
defineProperty
5396500.5 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 } })