Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
complex ES6 property get & getter function & direct access to object attribute
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Linux
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
ES6 property (get)
5676232.0 Ops/sec
Getter function
5633518.0 Ops/sec
Directly get
5827940.0 Ops/sec
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