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

Issue 291493003: Optimize QuadF's PointIsInTriangle function (Closed)

Created:
6 years, 7 months ago by jdduke (slow)
Modified:
6 years, 7 months ago
Reviewers:
danakj
CC:
chromium-reviews, aelias_OOO_until_Jul13, kuii.zheng, awoloszyn, Ian Vollick, enne (OOO)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Optimize QuadF's PointIsInTriangle function The original version required 34 float ops (16mul + 11sub + 5add + 2div). This version removes some of the intermediate dot products, reducing the max number of operations to 19 (6mul + 2div + 11sub). It also avoids using doubles, warranted by the removal of several intermediate operations that might otherwise incur significance loss. In local (release build) benchmarks, this reduced the typical CPU cost of a call to QuadF::Contains(...) by 2/3, both with GCC and Clang on an ARM v7 device. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=271088

Patch Set 1 #

Patch Set 2 : Cleanup #

Total comments: 4

Patch Set 3 : Add comment with equations #

Unified diffs Side-by-side diffs Delta from patch set Stats (+14 lines, -18 lines) Patch
M ui/gfx/geometry/quad_f.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/gfx/geometry/quad_f.cc View 1 2 1 chunk +13 lines, -17 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
jdduke (slow)
danakj@: PTAL. I'm hoping the elimination of the intermediate operations lessens the need for double ...
6 years, 7 months ago (2014-05-15 20:04:07 UTC) #1
danakj
https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc File ui/gfx/geometry/quad_f.cc (right): https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc#newcode66 ui/gfx/geometry/quad_f.cc:66: // (r1, r2, r3). This algorithm comes from Christer ...
6 years, 7 months ago (2014-05-16 15:43:43 UTC) #2
danakj
6 years, 7 months ago (2014-05-16 16:34:15 UTC) #3
jdduke (slow)
https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc File ui/gfx/geometry/quad_f.cc (right): https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc#newcode66 ui/gfx/geometry/quad_f.cc:66: // (r1, r2, r3). This algorithm comes from Christer ...
6 years, 7 months ago (2014-05-16 16:49:46 UTC) #4
danakj
LGTM https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc File ui/gfx/geometry/quad_f.cc (right): https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc#newcode66 ui/gfx/geometry/quad_f.cc:66: // (r1, r2, r3). This algorithm comes from ...
6 years, 7 months ago (2014-05-16 17:01:48 UTC) #5
danakj
Previously we were multiplying 2 floats as doubles to find the DotProduct, then multiplying the ...
6 years, 7 months ago (2014-05-16 17:02:53 UTC) #6
jdduke (slow)
https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc File ui/gfx/geometry/quad_f.cc (right): https://codereview.chromium.org/291493003/diff/20001/ui/gfx/geometry/quad_f.cc#newcode66 ui/gfx/geometry/quad_f.cc:66: // (r1, r2, r3). This algorithm comes from Christer ...
6 years, 7 months ago (2014-05-16 17:30:32 UTC) #7
jdduke (slow)
The CQ bit was checked by jdduke@chromium.org
6 years, 7 months ago (2014-05-16 17:30:35 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jdduke@chromium.org/291493003/40001
6 years, 7 months ago (2014-05-16 17:31:09 UTC) #9
commit-bot: I haz the power
6 years, 7 months ago (2014-05-16 20:13:57 UTC) #10
Message was sent while issue was closed.
Change committed as 271088

Powered by Google App Engine
This is Rietveld 408576698