Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Issue 2119813003: Fix for png encoding performance regressions (part 2) (Closed)

Created:
4 years, 5 months ago by msarett
Modified:
4 years, 5 months ago
Reviewers:
scroggo_chromium, Nico
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix for png encoding performance regressions (part 2) The original fix was: > Fix performance regression in png encoding caused by libpng update > > libpng calculates "filter heuristics" to choose which png > filter to apply. Chrome need not calculate these "filter > heuristics" because we always choose to use the SUB filter, > for speed. > > libpng 1.6 refactors the SUB filter to share code, also > forcing us to calculate the filter heuristics, even though > we don't need to. This caused a performance regression. > > This CL cherry picks a fix from upstream that: > (1) Passes PNG_SIZE_MAX to the filter code. This allows > the compiler to optimize out the heuristic calculation > code, fixing the performance regression. > (2) Fixes overflow handling in the calculation of filter > heuristics. This won't affect Chrome. > > Review-Url: https://codereview.chromium.org/2062423002 This fix was effective everywhere we use clang, but did not work on Android (GCC) or Windows (MSVS) because the compiler was not applying the appropriate optimizations. For the first fix to work, we need the compiler to inline the particular function *and* optimize out the unnecessary comparison with MAXINT. I suggested to upstream that they just accept a more portable fix, but that quickly became a philosophical discussion of "code size vs. performance" and didn't really go anywhere. They suggested that altering the compiler flags was an alternative, and they are right! I've altered the build files to apply the necessary flags on Android and Windows. I think this is the best option, though I'm not exactly sure if there's any problem with overriding Chrome's default optimization flags. Other options (which I think are worse) include: (1) Forking our copy of libpng to apply a non-compiler dependent fix. (2) Accepting the regression. (FWIW, I'm not 100% sure on Windows - it worked on my local Windows box, but I can't get the Windows perf trybots to work). BUG=619850 BUG=599917

Patch Set 1 #

Patch Set 2 : No need for inline flag on Win #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -0 lines) Patch
M third_party/libpng/BUILD.gn View 1 2 chunks +25 lines, -0 lines 2 comments Download
M third_party/libpng/libpng.gyp View 1 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (10 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2119813003/1
4 years, 5 months ago (2016-07-01 12:48:02 UTC) #6
msarett
Finally was able to get up and running on Windows to test this. Please take ...
4 years, 5 months ago (2016-07-01 13:12:30 UTC) #9
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-simulator-gn on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator-gn/builds/30292) win_chromium_x64_rel_ng on ...
4 years, 5 months ago (2016-07-01 13:16:54 UTC) #11
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2119813003/20001
4 years, 5 months ago (2016-07-01 13:31:49 UTC) #13
Nico
It seems extremely fragile to require such specific compiler flags. Can we carry this as ...
4 years, 5 months ago (2016-07-01 14:12:33 UTC) #14
msarett
> It seems extremely fragile to require such specific compiler flags. > Can we carry ...
4 years, 5 months ago (2016-07-01 14:44:33 UTC) #15
Nico
On 2016/07/01 14:44:33, msarett wrote: > > It seems extremely fragile to require such specific ...
4 years, 5 months ago (2016-07-01 14:53:59 UTC) #16
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 5 months ago (2016-07-01 15:10:44 UTC) #18
msarett
4 years, 5 months ago (2016-07-01 16:12:14 UTC) #19
Thanks for your thoughts.  Definitely understand where you're coming from.  I'm
going to try a few experiments to see if there's any way to avoid forking...

Otherwise, I'll upload that option next.

Powered by Google App Engine
This is Rietveld 408576698