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