Getter vs direct access (v2)

Revision 2 of this 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
Direct access
const value = test._value
ready

Revisions

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