Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
ES6 property get & getter function & direct access to object attribute
(version: 1)
Comparing performance of:
ES6 property (get) vs Getter function vs Directly get
Created:
10 months ago
by:
Guest
Jump to the latest result
Script Preparation code:
class Class { constructor () { this._val = 1 } 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
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
ES6 property (get)
Getter function
Directly get
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Goanna/6.8 PaleMoon/34.0.1
Browser/OS:
Pale Moon (Firefox Variant) 34 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
ES6 property (get)
7731942.0 Ops/sec
Getter function
7946861.0 Ops/sec
Directly get
7839410.0 Ops/sec
Related benchmarks:
ES6 property (get/set) & getter/setter function & direct access to object attribute
ES6 property get & getter function & direct access to object attribute
Data Properties vs Getter / Setter Methods ES2015
class set get (getters, function, direct)
field vs property2
field vs property23
class getter/setter vs property
Public vs Private properties
complex ES6 property get & getter function & direct access to object attribute
Comments
Confirm delete:
Do you really want to delete benchmark?