Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Public vs Private properties
Comparing the get and set performance of directly accessing a field on a class versus using a getter/setter pair on a private property.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 15; Mobile; rv:137.0) Gecko/137.0 Firefox/137.0
Browser:
Firefox Mobile 137
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Direct get
553819520.0 Ops/sec
proxied get
562923328.0 Ops/sec
direct set
638606784.0 Ops/sec
proxied set
636245824.0 Ops/sec
Script Preparation code:
class Test { get bar() { return this.#bar }; set bar(v) { this.#bar = v }; foo = 1; #bar = 1; } var test = new Test; var x;
Tests:
Direct get
x = test.foo;
proxied get
x = test.bar
direct set
test.foo = 2;
proxied set
test.bar = 2;