diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2014-01-30 09:57:04 +0100 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2014-01-30 09:57:04 +0100 |
| commit | ae8251b0aa946177877f61b45a96e90319dce1ff (patch) | |
| tree | 3752f72ee7726e6c40f2f1071d1097994454508a /src/pkg/runtime/malloc.h | |
| parent | 7a73f32725ff8b13a4cca703972fa76e598f4436 (diff) | |
| download | go-ae8251b0aa946177877f61b45a96e90319dce1ff.tar.xz | |
net/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.
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/58260043
Diffstat (limited to 'src/pkg/runtime/malloc.h')
0 files changed, 0 insertions, 0 deletions
