Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
getter vs. func
(version: 1)
Comparing performance of:
access cost vs 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:
access cost
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/
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 (3)
Previous results
Fork
Test case name
Result
access cost
getter
func
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0
Browser/OS:
Firefox 145 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
access cost
760033664.0 Ops/sec
getter
23567.5 Ops/sec
func
23874.9 Ops/sec
Related benchmarks:
TestArrayAllocationv2
Array population
Array.from vs Array.fill (zeroes)
12132132132131243214124
Set from array vs .add
For vs Foreach manu
test array.includes vs set.has 2
Array length to string 1
getter vs. func2
Comments
Confirm delete:
Do you really want to delete benchmark?