Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
ES6 property (get/set) & getter/setter function & direct access to object attribute 2
(version: 0)
Comparing performance of:
ES6 property (get) vs Getter function vs Directly get vs ES6 property (set) vs Setter function vs Directly set
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function Class { this._val = 1 } Class.prototype = { get value() { return this._val } set value(x) { this._val = x } getValue: () => { return this._val } setValue: (x) => { this.val = x } } var cls = new Class() var wtf
Tests:
ES6 property (get)
wtf = cls.value
Getter function
wtf = cls.getValue()
Directly get
wtf = cls._val
ES6 property (set)
cls.value = 1
Setter function
cls.setValue(1)
Directly set
cls._val = 1
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
ES6 property (get)
Getter function
Directly get
ES6 property (set)
Setter function
Directly set
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?