]> Cypherpunks repositories - gostls13.git/commit
image/png: optimize the paeth filter implementation.
authorNigel Tao <nigeltao@golang.org>
Fri, 25 May 2012 04:08:51 +0000 (14:08 +1000)
committerNigel Tao <nigeltao@golang.org>
Fri, 25 May 2012 04:08:51 +0000 (14:08 +1000)
commit1423ecb1266c9af288caa2723988a326adf7118e
treee61d1ae37011208293d789cf846e8f7cd4e0a694
parent97cbf47c78abf6f776640902804fb0006567a2ec
image/png: optimize the paeth filter implementation.

image/png benchmarks:
benchmark                       old ns/op    new ns/op    delta
BenchmarkPaeth                         10            7  -29.21%
BenchmarkDecodeGray               2381745      2241620   -5.88%
BenchmarkDecodeNRGBAGradient      9535555      8835100   -7.35%
BenchmarkDecodeNRGBAOpaque        8189590      7611865   -7.05%
BenchmarkDecodePaletted           1300688      1301940   +0.10%
BenchmarkDecodeRGB                6760146      6317082   -6.55%
BenchmarkEncodePaletted           6048596      6122666   +1.22%
BenchmarkEncodeRGBOpaque         18891140     19474230   +3.09%
BenchmarkEncodeRGBA              78945350     78552600   -0.50%

Wall time for Denis Cheremisov's PNG-decoding program given in
https://groups.google.com/group/golang-nuts/browse_thread/thread/22aa8a05040fdd49
Before: 2.25s
After:  2.27s
Delta:  +1%

The same program, but with a different PNG input file
(http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png)
and only 100 iterations instead of 1000
Before: 4.78s
After:  4.42s
Delta:  -8%

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