]> Cypherpunks repositories - gostls13.git/commit
image/png: optimize paeth some more.
authorNigel Tao <nigeltao@golang.org>
Wed, 30 May 2012 11:38:46 +0000 (21:38 +1000)
committerNigel Tao <nigeltao@golang.org>
Wed, 30 May 2012 11:38:46 +0000 (21:38 +1000)
commitdbcdce5866502aadc9b3e70e06c92d2afb22e1e1
tree7135317f9a13682c86f89f02b7c1944cf2da1665
parent994cdcea18402c8fa04fa5a039f711b886c89328
image/png: optimize paeth some more.

filterPaeth takes []byte arguments instead of byte arguments,
which avoids some redudant computation of the previous pixel
in the inner loop.

Also eliminate a bounds check in decoding the up filter.

benchmark                       old ns/op    new ns/op    delta
BenchmarkDecodeGray               3139636      2812531  -10.42%
BenchmarkDecodeNRGBAGradient     12341520     10971680  -11.10%
BenchmarkDecodeNRGBAOpaque       10740780      9612455  -10.51%
BenchmarkDecodePaletted           1819535      1818913   -0.03%
BenchmarkDecodeRGB                8974695      8178070   -8.88%

R=rsc
CC=golang-dev
https://golang.org/cl/6243061
src/pkg/image/png/paeth.go [new file with mode: 0644]
src/pkg/image/png/paeth_test.go
src/pkg/image/png/reader.go