While looking at the Go http.StatusText() function, I noticed it uses a long switch case instead of something like a map[int]string.
I’m curious about the trade-offs:
- Performance (lookup speed)
- Memory usage
- Any other practical impacts of choosing one over the other
When should you prefer a switch case, and when is a map the better option?