Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Performance difference between Object.defineProperty() and Object.defineProperties()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.defineProperty()
106150.4 Ops/sec
Object.defineProperties()
104888.2 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var testProps = {} for(let i = 1; i < 100; i++){ if(i%2){ testProps[`aa${i}`] = { value: i, writable: true, enumerable: false, configurable: false } } else { testProps[`aa${i}`] = { get(){ return this[`bb${i}`] }, set(nv){ this[`bb${i}`] = 2 * nv + 3; return true; }, enumerable: false, configurable: false } } }
Tests:
Object.defineProperty()
const testObj = {}, testProps_ = {...testProps}; for(let a in testProps_){ Object.defineProperty(testObj, a, testProps_[a]); }
Object.defineProperties()
const testObj = {}, testProps_ = {...testProps}; Object.defineProperties(testObj, testProps_)