Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
defineproperty vs direct assignment
(version: 0)
Comparing performance of:
a vs b
Created:
9 years ago
by:
Guest
Jump to the latest result
Tests:
a
var target = {}; var key = 'something'; for (var i=0; i<1000; i++) { Object.defineProperty(target, key+i, { get: function() {return _val;}, set: function(v) { target._v = v}, }); }
b
var target = {}; var key = 'something'; for (var i=0; i<1000; i++) { target[key+1] = undefined; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
a
b
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Browser/OS:
Chrome 140 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
a
4523.7 Ops/sec
b
97577.4 Ops/sec
Related benchmarks:
Object.assign vs direct copy
Object.prototype.hasOwnProperty vs obj.hasOwnProperty
Object.assign() vs Reflect.set()
Object.setPrototypeOf vs Object literal
Assignment of value vs Destructuring an object (direct assign insted of variable )
Comments
Confirm delete:
Do you really want to delete benchmark?