That's the function used the benchmark the single lookup using a const literal on a literal map, and compared to the switch one yes it's 96 slower, of course, I'm talking slower on my MAC.
I already said, that optimizing that is somewhat unnecessary. But with that PR that function becomes similar to a func mapImplementation () int { return 0 }. This means there is no map allocation at all.
func mapImplementation() int {
return map[string]int{
"amd64": 0,
"arm": 1,
"arm64": 2,
}[runtime.GOARCH]
}
what are you thinking?
That's the function used the benchmark the single lookup using a const literal on a literal map, and compared to the switch one yes it's 96 slower, of course, I'm talking slower on my MAC.
I already said, that optimizing that is somewhat unnecessary. But with that PR that function becomes similar to a
func mapImplementation () int { return 0 }
. This means there is no map allocation at all.each time alloc a map ?
96 times slower!!!! lol