From: Nigel Tao Date: Sun, 7 Oct 2012 08:32:28 +0000 (+1100) Subject: image/jpeg: move the huffman bit decoder state higher up in the X-Git-Tag: go1.1rc2~2227 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d7b7957db16da1311ce1a8623d7c4c5a154cf815;p=gostls13.git image/jpeg: move the huffman bit decoder state higher up in the decoder struct, inside the unmappedzero limit, to eliminate some TESTB instructions in the inner decoding loop. benchmark old ns/op new ns/op delta BenchmarkDecode 2943204 2746360 -6.69% R=r, dave CC=golang-dev https://golang.org/cl/6625058 --- diff --git a/src/pkg/image/jpeg/reader.go b/src/pkg/image/jpeg/reader.go index 263ef45aac..415b093281 100644 --- a/src/pkg/image/jpeg/reader.go +++ b/src/pkg/image/jpeg/reader.go @@ -92,6 +92,7 @@ type Reader interface { type decoder struct { r Reader + b bits width, height int img1 *image.Gray img3 *image.YCbCr @@ -100,7 +101,6 @@ type decoder struct { comp [nColorComponent]component huff [maxTc + 1][maxTh + 1]huffman quant [maxTq + 1]block // Quantization tables, in zig-zag order. - b bits tmp [1024]byte }