Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
complex 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 () { const id = "hello"; this._id = id; this.data = [id]; this.indexByField = { id: 0 }; } get id() { return this.data[this.indexByField.id] } getId() { return this.data[this.indexByField.id] } } var cls = new Class() var wtf
Tests:
ES6 property (get)
wtf = cls.id
Getter function
wtf = cls.getId()
Directly get
wtf = cls._id
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:
10 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
ES6 property (get)
12363408.0 Ops/sec
Getter function
12466762.0 Ops/sec
Directly get
12559932.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
Object.values at index vs access name of property
class set get (getters, function, direct)
field vs property2
field vs property23
field vs property2344
class getter/setter vs property
ES6 property get & getter function & direct access to object attribute
Comments
Confirm delete:
Do you really want to delete benchmark?