go/src/image
Artyom Pervukhin 088209bbe8 image/draw: reduce drawPaletted allocations for special source cases
drawPaletted has to discover R,G,B,A color values of each source image
pixel in a given rectangle. Doing that by calling image.Image.At()
method returning color.Color interface is quite taxing allocation-wise
since interface values go through heap. Introduce special cases for some
concrete source types by fetching color values using type-specific
methods.

name        old time/op    new time/op    delta
Paletted-4    7.62ms ± 4%    3.72ms ± 3%   -51.20%  (p=0.008 n=5+5)

name        old alloc/op   new alloc/op   delta
Paletted-4     480kB ± 0%       0kB ± 0%   -99.99%  (p=0.000 n=4+5)

name        old allocs/op  new allocs/op  delta
Paletted-4      120k ± 0%        0k ± 0%  -100.00%  (p=0.008 n=5+5)

Updates #15759.

Change-Id: I0ce1770ff600ac80599541aaad4c2c826855c8fb
Reviewed-on: https://go-review.googlesource.com/72370
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2017-10-25 23:43:27 +00:00
..
color all: fix article typos 2017-09-15 02:39:16 +00:00
draw image/draw: reduce drawPaletted allocations for special source cases 2017-10-25 23:43:27 +00:00
gif image/gif: avoid setting defers in the decode loop 2017-10-23 22:59:18 +00:00
internal/imageutil image/color: tweak the YCbCr to RGBA conversion formula again. 2017-02-10 22:57:50 +00:00
jpeg image/gif: add BenchmarkDecode. 2017-10-07 05:23:42 +00:00
png image/png: fix width * height * bpp overflow check. 2017-10-21 22:00:32 +00:00
testdata image/jpeg: reconstruct progressive images even if incomplete. 2016-03-31 00:33:24 +00:00
decode_example_test.go image/color: tweak the YCbCr to RGBA conversion formula. 2015-07-15 05:29:00 +00:00
decode_test.go image/jpeg: reconstruct progressive images even if incomplete. 2016-03-31 00:33:24 +00:00
format.go build: move package sources from src/pkg to src 2014-09-08 00:08:51 -04:00
geom.go image: fix the overlap check in Rectangle.Intersect. 2017-02-10 05:05:59 +00:00
geom_test.go image: fix the overlap check in Rectangle.Intersect. 2017-02-10 05:05:59 +00:00
image.go image: add NYCbCrA types. 2015-10-11 11:07:25 +00:00
image_test.go all: remove some unused parameters in test code 2017-04-25 14:38:10 +00:00
names.go build: move package sources from src/pkg to src 2014-09-08 00:08:51 -04:00
ycbcr.go image: add NYCbCrA types. 2015-10-11 11:07:25 +00:00
ycbcr_test.go image: add YCbCrSubsampleRatio411 and YCbCrSubsampleRatio410. 2015-02-26 00:14:16 +00:00