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 with calculations
(version: 1)
Comparing performance of:
ES6 property (get) vs Getter function vs Directly get vs ES6 property (set) vs Setter function vs Directly set
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
class Class { constructor () { this._val = 1 } get value() { return this._val * 2 + 1 } set value(x) { this._val = x } getValue() { return this._val * 2 + 1 } 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 * 2 + 1
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?