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 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Linux
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
Object.defineProperty()
98805.9 Ops/sec
Object.defineProperties()
48612.7 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_)