Switch vs Object Function vs Object Property
Compares performance of using a 'switch' statement vs object functions and object properties
5 months ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Test name |
Executions per second |
Switch |
149162.3 Ops/sec |
Object Function |
149529.0 Ops/sec |
Object Property |
150693.9 Ops/sec |
Tests:
-
Switch
-
Object Function
-
Object Property
Open this result on MeasureThat.net