ES6 property (get) vs Getter function vs Directly get vs ES6 property (set) vs Setter function vs Directly setFastest: Setter function (3.1x faster)
30,080,532 ops/sec
30,067,328 ops/sec
30,050,098 ops/sec
10,125,688 ops/sec
10,013,770 ops/sec
9,850,222 ops/sec
Fastest: ES6 property (set) (1.6x faster)
668,133,312 ops/sec
665,300,992 ops/sec
588,798,080 ops/sec
468,817,856 ops/sec
436,712,480 ops/sec
409,875,360 ops/sec
Fastest: ES6 property (set) (2.1x faster)
14,368,485 ops/sec
14,045,416 ops/sec
13,467,989 ops/sec
6,984,238 ops/sec
6,934,939 ops/sec
6,771,478 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| ES6 property (get) | |
| Getter function | |
| Directly get | |
| ES6 property (set) | |
| Setter function | |
| Directly set |
| Test name | Executions per second |
|---|---|
| ✓ Setter function | 123,234,120 Ops/sec |
| Directly set | 119,511,040 Ops/sec |
| ES6 property (set) | 112,687,680 Ops/sec |
| Directly get | 7,695,976 Ops/sec |
| ES6 property (get) | 7,695,340 Ops/sec |
| Getter function | 7,635,258 Ops/sec |