|
|
|
|
|
by siddontang
1409 days ago
|
|
Using map or array instead of switch-case is a common optimization way, but please do a benchmark if you have no confidence whether you need do or not. E.g, it doesn't already work in Go, https://stackoverflow.com/questions/46789259/map-vs-switch-p... But if there are too many switch-cases, the codes may be ugly to read, so maybe using a map or array is a better choice here. |
|
https://go.dev/doc/go1.19#compiler