Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
getter vs. func2
(version: 1)
Comparing performance of:
getter vs func
Created:
3 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
class Test { constructor() { this._data = new Uint32Array([1,2]); } get one() { return this._data[0]; } getTwo() { return this._data[1]; } } const tt = new Test();
Tests:
getter
let result = 0; for (let i = 0; i < 1000; ++i) result += tt.one; console.log(result);
func
let result = 0; for (let i = 0; i < 1000; ++i) result += tt.getTwo(); console.log(result);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
getter
func
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 months ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 26_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) EdgiOS/143.0.3650.139 Version/26.0 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 26 on iOS 26.2.1
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
getter
71448.5 Ops/sec
func
68561.8 Ops/sec
Related benchmarks:
Test for vs foreach vs forof
destru vs for
name123123
another tesatdqd
Inlining
Math.log10() vs .toString().length
for vs for of2
For Difference
getter vs. func
Comments
Confirm delete:
Do you really want to delete benchmark?