Getter vs direct access

Benchmark created on


Preparation HTML

<script>
class Test {
    _value = 1337

    get value() {
		return this._value
	}
	getValue() {
		return this._value
	}
    arrowValue = () => this._value
}

const test = new Test()
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Getter
const value = test.value
ready
Direct method
const value = test.getValue()
ready
Arrow property
const value = test.arrowValue()
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.