Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
getter vs. func2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Browser:
Chrome 144
Operating system:
Linux
Device Platform:
Desktop
Date tested:
3 months ago
Test name
Executions per second
getter
42870.0 Ops/sec
func
41539.4 Ops/sec
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);