loading...

re: My journey optimizing the Go Compiler VIEW POST

TOP OF THREAD FULL DISCUSSION
re: func mapImplementation() int { return map[string]int{ "amd64": 0, "arm": 1, "arm64": 2, }[runtime.GOARCH] } what...
 

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.

Code of Conduct Report abuse