• Brad Fitzpatrick's avatar
    net/http: use a struct instead of a string in transport conn cache key · ae8251b0
    Brad Fitzpatrick authored
    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.
    
    LGTM=adg
    R=adg
    CC=golang-codereviews
    https://golang.org/cl/58260043
    ae8251b0
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...