• Justin Nuß's avatar
    mime: Remove an allocation in word decoding. · d0c9b409
    Justin Nuß authored
    This fixes a TODO in (*WordDecoder).Decode by replacing a call to strings.Split with
    simple prefix/suffix checking and some custom slicing.
    
    Benchmark results:
    
    benchmark                    old ns/op     new ns/op     delta
    BenchmarkQEncodeWord-8       740           693           -6.35%
    BenchmarkQDecodeWord-8       1291          727           -43.69%
    BenchmarkQDecodeHeader-8     1194          767           -35.76%
    
    benchmark                    old allocs     new allocs     delta
    BenchmarkQEncodeWord-8       1              1              +0.00%
    BenchmarkQDecodeWord-8       3              2              -33.33%
    BenchmarkQDecodeHeader-8     3              2              -33.33%
    
    benchmark                    old bytes     new bytes     delta
    BenchmarkQEncodeWord-8       48            48            +0.00%
    BenchmarkQDecodeWord-8       128           48            -62.50%
    BenchmarkQDecodeHeader-8     128           48            -62.50%
    
    Change-Id: I2d6844c75ec2e2b79be2e49b7fc4ca320b7e84e5
    Reviewed-on: https://go-review.googlesource.com/14432Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    d0c9b409
Name
Last commit
Last update
..
multipart Loading commit data...
quotedprintable Loading commit data...
testdata Loading commit data...
encodedword.go Loading commit data...
encodedword_test.go Loading commit data...
example_test.go Loading commit data...
grammar.go Loading commit data...
mediatype.go Loading commit data...
mediatype_test.go Loading commit data...
type.go Loading commit data...
type_dragonfly.go Loading commit data...
type_freebsd.go Loading commit data...
type_openbsd.go Loading commit data...
type_plan9.go Loading commit data...
type_test.go Loading commit data...
type_unix.go Loading commit data...
type_windows.go Loading commit data...