go/src/mime
Justin Nuß d0c9b40964 mime: Remove an allocation in word decoding.
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/14432
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-18 17:31:52 +00:00
..
multipart mime/multipart: fix peekBufferSeparatorIndex edge case 2015-10-09 16:27:43 +00:00
quotedprintable mime/quotedprintable: Return a Reader instead of an io.Reader 2015-04-16 16:18:26 +00:00
testdata
encodedword.go mime: Remove an allocation in word decoding. 2015-10-18 17:31:52 +00:00
encodedword_test.go mime: limit UTF-8 encoded-word length to 75 characters 2015-10-15 00:08:03 +00:00
example_test.go mime: move examples to external test file 2015-08-22 18:39:29 +00:00
grammar.go all: use "reports whether" in place of "returns true if(f)" 2015-03-18 15:14:06 +00:00
mediatype.go
mediatype_test.go
type.go mime: tighten up and simplify tests 2015-03-30 09:12:03 +00:00
type_dragonfly.go mime: add mime.types paths for BSDs 2015-06-12 15:51:21 +00:00
type_freebsd.go mime: add mime.types paths for BSDs 2015-06-12 15:51:21 +00:00
type_openbsd.go mime: add mime.types paths for BSDs 2015-06-12 15:51:21 +00:00
type_plan9.go mime: tighten up and simplify tests 2015-03-30 09:12:03 +00:00
type_test.go mime: tighten up and simplify tests 2015-03-30 09:12:03 +00:00
type_unix.go mime: tighten up and simplify tests 2015-03-30 09:12:03 +00:00
type_windows.go mime, time, internal/syscall/windows/registry: use new registry package to simplify code 2015-04-30 04:33:42 +00:00