• Jeff R. Allen's avatar
    net/textproto: faster header canonicalization with fewer allocations · 7e7b89f7
    Jeff R. Allen authored
    By keeping a single copy of the strings that commonly show up
    in headers, we can avoid one string allocation per header.
    
    benchmark                  old ns/op    new ns/op    delta
    BenchmarkReadMIMEHeader        19590        10824  -44.75%
    BenchmarkUncommon               3168         1861  -41.26%
    
    benchmark                 old allocs   new allocs    delta
    BenchmarkReadMIMEHeader           32           25  -21.88%
    BenchmarkUncommon                  5            5    0.00%
    
    R=bradfitz, golang-dev, dave, rsc, jra
    CC=golang-dev
    https://golang.org/cl/6721055
    7e7b89f7
reader_test.go 8.64 KB