Descriptionnet/http: use a struct instead of a string in transport conn cache key
The Transport's idle connection cache is keyed by a string,
for pre-Go 1.0 reasons. Ever since Go has been able to use
structs as map keys, there's been a TODO in the code to use
structs instead of allocating strings. This change does that.
Saves 3 allocatins and ~100 bytes of garbage per client
request. But because string hashing is so fast these days
(thanks, Keith), the performance is a wash: what we gain
on GC and not allocating, we lose in slower hashing. (hashing
structs of strings is slower than 1 string)
This seems a bit faster usually, but I've also seen it be a
bit slower. But at least it's how I've wanted it now, and it
the allocation improvements are consistent.
Patch Set 1 #Patch Set 2 : diff -r 08918ee18957 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 08918ee18957 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r a177faebc7fc https://go.googlecode.com/hg/ #
MessagesTotal messages: 5
|