Comment

Comment by siddontang

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.

parent siddontang 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton