Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(17)

Issue 4432077: code review 4432077: png: speed up opaque RGBA encoding (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by bradfitz
Modified:
14 years ago
Reviewers:
CC:
nigeltao, rsc, r, golang-dev
Visibility:
Public.

Description

png: speed up opaque RGBA encoding With Linux/8g on a 2006 Mac Mini (1.66 GHz Intel Core Duo, 2KB L1, 2MB L2, 2G main memory), GOMAXPROCS unset: start: png.BenchmarkEncodePaletted 50 44772820 ns/op png.BenchmarkEncodeRGBOpaque 10 208395900 ns/op png.BenchmarkEncodeRGBA 5 331088000 ns/op remove interface method calls: png.BenchmarkEncodePaletted 50 44722880 ns/op png.BenchmarkEncodeRGBOpaque 10 139042600 ns/op png.BenchmarkEncodeRGBA 5 334033600 ns/op flate inline min/max(): png.BenchmarkEncodePaletted 50 40631180 ns/op png.BenchmarkEncodeRGBOpaque 10 124894900 ns/op png.BenchmarkEncodeRGBA 5 312099000 ns/op after adler change: png.BenchmarkEncodePaletted 50 40181760 ns/op png.BenchmarkEncodeRGBOpaque 20 121781950 ns/op png.BenchmarkEncodeRGBA 5 313890800 ns/op In comparison to 121 ms on this 2006 machine, on my Core2 Duo 2.66 GHz laptop, the final BenchmarkEncodeRGBOpaque runs in 27 ms. (these are all for 640x480 images)

Patch Set 1 #

Patch Set 2 : diff -r ff32eff02b8e https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 3 : diff -r ff32eff02b8e https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 4abcd1a58d3d https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 5 : diff -r 9266c53a8fc0 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -11 lines) Patch
M src/pkg/compress/flate/deflate.go View 1 2 3 chunks +24 lines, -5 lines 0 comments Download
M src/pkg/image/png/writer.go View 1 2 3 4 2 chunks +23 lines, -6 lines 0 comments Download

Messages

Total messages: 11
bradfitz
Hello nigeltao, rsc, r (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years ago (2011-04-28 05:02:04 UTC) #1
bradfitz
I'm also fine leaving the min and max inlining out of this. While it's noticeable, ...
14 years ago (2011-04-28 05:06:54 UTC) #2
r
LGTM, but maybe let nigel have a look. thanks for putting the numbers in the ...
14 years ago (2011-04-28 06:06:26 UTC) #3
bradfitz
http://codereview.appspot.com/4432077/diff/3/src/pkg/compress/flate/deflate.go File src/pkg/compress/flate/deflate.go (right): http://codereview.appspot.com/4432077/diff/3/src/pkg/compress/flate/deflate.go#newcode147 src/pkg/compress/flate/deflate.go:147: if -1 > v { On 2011/04/28 06:06:26, r ...
14 years ago (2011-04-28 06:36:34 UTC) #4
bradfitz
Hello nigeltao, rsc, r (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-28 06:36:46 UTC) #5
r
LGTM
14 years ago (2011-04-28 07:17:05 UTC) #6
bradfitz
I'll wait for Nigel too. I also haven't tested an actual image with this and ...
14 years ago (2011-04-28 07:20:20 UTC) #7
rsc
Please use b.SetBytes in the benchmark. Then you will get some MB/s times too, which ...
14 years ago (2011-04-28 11:51:39 UTC) #8
nigeltao
LGTM. http://codereview.appspot.com/4432077/diff/10004/src/pkg/image/png/writer.go File src/pkg/image/png/writer.go (right): http://codereview.appspot.com/4432077/diff/10004/src/pkg/image/png/writer.go#newcode315 src/pkg/image/png/writer.go:315: xoff := 3 * b.Min.X Add a +1 ...
14 years ago (2011-05-02 09:05:50 UTC) #9
bradfitz
Hello nigeltao, rsc, r (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years ago (2011-05-02 14:25:41 UTC) #10
bradfitz
14 years ago (2011-05-02 14:26:04 UTC) #11
*** Submitted as http://code.google.com/p/go/source/detail?r=66eb68cbd5c2 ***

png: speed up opaque RGBA encoding

With Linux/8g on a 2006 Mac Mini (1.66 GHz Intel Core Duo,
2KB L1, 2MB L2, 2G main memory), GOMAXPROCS unset:

start:
png.BenchmarkEncodePaletted	      50	  44772820 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 208395900 ns/op
png.BenchmarkEncodeRGBA		       5	 331088000 ns/op

remove interface method calls:
png.BenchmarkEncodePaletted	      50	  44722880 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 139042600 ns/op
png.BenchmarkEncodeRGBA		       5	 334033600 ns/op

flate inline min/max():
png.BenchmarkEncodePaletted	      50	  40631180 ns/op
png.BenchmarkEncodeRGBOpaque	      10	 124894900 ns/op
png.BenchmarkEncodeRGBA		       5	 312099000 ns/op

after adler change:
png.BenchmarkEncodePaletted	      50	  40181760 ns/op
png.BenchmarkEncodeRGBOpaque	      20	 121781950 ns/op
png.BenchmarkEncodeRGBA		       5	 313890800 ns/op

In comparison to 121 ms on this 2006 machine, on my
Core2 Duo 2.66 GHz laptop, the final BenchmarkEncodeRGBOpaque
runs in 27 ms. (these are all for 640x480 images)

R=nigeltao, rsc, r
CC=golang-dev
http://codereview.appspot.com/4432077
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b