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

Issue 117290043: code review 117290043: image/png: use branch-free abs function (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 9 months ago by ruiu
Modified:
9 years, 9 months ago
Reviewers:
nigeltao, gobot, minux, dave
CC:
nigeltao, golang-codereviews
Visibility:
Public.

Description

image/png: use branch-free abs function benchmark old ns/op new ns/op delta BenchmarkPaeth 5.06 6.02 +18.97% BenchmarkDecodeGray 1010551 956911 -5.31% BenchmarkDecodeNRGBAGradient 3877813 3754160 -3.19% BenchmarkDecodeNRGBAOpaque 3194058 3079094 -3.60% BenchmarkDecodePaletted 699243 700211 +0.14% BenchmarkDecodeRGB 2835733 2692120 -5.06% BenchmarkDecodeInterlacing 3651805 3563124 -2.43% BenchmarkEncodeGray 4399183 4404113 +0.11% BenchmarkEncodeNRGBOpaque 13323627 13306485 -0.13% BenchmarkEncodeNRGBA 15840092 15751188 -0.56% BenchmarkEncodePaletted 4396622 4404373 +0.18% BenchmarkEncodeRGBOpaque 13320475 13279189 -0.31% BenchmarkEncodeRGBA 36898392 36781002 -0.32%

Patch Set 1 #

Patch Set 2 : diff -r 7e9ede8077ba https://code.google.com/p/go #

Patch Set 3 : diff -r 7e9ede8077ba https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -24 lines) Patch
M src/pkg/image/png/paeth.go View 3 chunks +21 lines, -20 lines 0 comments Download
M src/pkg/image/png/paeth_test.go View 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 9
ruiu
Hello nigeltao@golang.org (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
9 years, 9 months ago (2014-07-29 04:05:54 UTC) #1
ruiu
I'm not very happy about copy-and-pasting CL 107340047 but have no idea better than doing ...
9 years, 9 months ago (2014-07-29 04:08:20 UTC) #2
nigeltao
LGTM.
9 years, 9 months ago (2014-07-29 04:28:23 UTC) #3
nigeltao
*** Submitted as https://code.google.com/p/go/source/detail?r=d4f4fb0e307c *** image/png: use branch-free abs function benchmark old ns/op new ns/op ...
9 years, 9 months ago (2014-07-29 04:29:33 UTC) #4
gobot
This CL appears to have broken the linux-386-387 builder. See http://build.golang.org/log/33e057ec87cf705d5c479f18f5b53a018264c315
9 years, 9 months ago (2014-07-29 04:31:14 UTC) #5
dave_cheney.net
cmd/gc <built-in>:0:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed ...
9 years, 9 months ago (2014-07-29 04:47:04 UTC) #6
ruiu
GCC failed with an internal compiler error. Unlikely to related to this CL but seems ...
9 years, 9 months ago (2014-07-29 04:47:16 UTC) #7
minux
I think this function is potentially useful in a lot of places, could we add ...
9 years, 9 months ago (2014-07-29 21:56:43 UTC) #8
ruiu
9 years, 9 months ago (2014-07-29 22:36:36 UTC) #9
There are indeed several dozen occurrences of the pattern "if (x < 0) { x =
-x }" in the standard library, but none of them except this seems to be in
a performance critical path. We probably don't need branch-less abs
function there.

On the other hand, abs(x) is just more readable than the if pattern, so it
may worth doing for the sake of that. Also if we have the package we could
add new utility functions such as saturation arithmetic ones there. I
honestly don't know what we should do. WDYT.

On Tue, Jul 29, 2014 at 2:56 PM, minux <minux@golang.org> wrote:

> I think this function is potentially useful in a lot of places, could we
> add that to a internal package? e.g. internal/math.
>
Sign in to reply to this message.

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