According to David's pres (
http://go-talks.appspot.com/github.com/davecheney/presentations/writing-high-performance-go.slide#30)
<http://go-talks.appspot.com/github.com/davecheney/presentations/writing-high-performance-go.slide#30>,
if you want use []byte as map key, the compiler implements some
optimization (avoid the conversion []byte -> string) when you do this:
var m map[string]string
v, ok := m[string(bytes)]
but not:
key := string(bytes)
val, ok := m[key]
As net.IP is []byte, does the compiler implement the same optimization when
you do this :
var m map[string]string
val, ok := m[string(net.IPv4zero)]
or I have to do this:
var m map[string]string
val, ok := m[string([]byte(net.IPv4zero))]
Thx in adv (special thx to Dave for this pres and his kindness :) )
Jérôme
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.