stream-vbyte-go
stream-vbyte-go copied to clipboard
lookup: use byte literal instead of map
This eliminates a runtime.mapaccess1 call (in favor of a memory access) whereever lookup[ctrl] is used.
I learned that [...]int{10:2} is valid in Go. I don’t think it is in the spec?
Both the ...
syntax and the usage of keys for an array literal are defined in https://golang.org/ref/spec#Composite_literals:
The key is interpreted as a field name for struct literals, an index for array and slice literals, and a key for map literals.
The notation ... specifies an array length equal to the maximum element index plus one.
I hope that clarifies things :)
Yes, I see it now.