RESOLVED FIXED 194073
Hit testing functions optimizations
https://bugs.webkit.org/show_bug.cgi?id=194073
Summary Hit testing functions optimizations
Benjamin Poulain
Reported 2019-01-30 20:39:59 PST
<rdar://problem/47692312> Hit testing functions optimizations
Attachments
Patch (7.72 KB, patch)
2019-01-30 20:42 PST, Benjamin Poulain
no flags
Patch (10.43 KB, patch)
2019-01-31 20:37 PST, Benjamin Poulain
no flags
Patch (21.24 KB, patch)
2019-02-01 18:44 PST, Benjamin Poulain
no flags
Patch (4.22 KB, patch)
2019-02-04 21:06 PST, Benjamin Poulain
no flags
Benjamin Poulain
Comment 1 2019-01-30 20:42:00 PST
Benjamin Poulain
Comment 2 2019-01-30 20:42:02 PST
Simon Fraser (smfr)
Comment 3 2019-01-31 13:58:11 PST
Comment on attachment 360684 [details] Patch Do any of these really make measurable perf improvements?
Benjamin Poulain
Comment 4 2019-01-31 15:58:44 PST
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 360684 [details] > Patch > > Do any of these really make measurable perf improvements? Oh yeah. Maybe not on your machine but on older CPUs that hurts.
Tim Horton
Comment 5 2019-01-31 16:04:19 PST
Comment on attachment 360684 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360684&action=review > Source/WTF/ChangeLog:4 > + <rdar://problem/47692312> Hit testing functions optimizations > + https://bugs.webkit.org/show_bug.cgi?id=194073 This is usually: Title Bugzilla link Radar link
Simon Fraser (smfr)
Comment 6 2019-01-31 16:07:00 PST
"webkit-patch upload" will format the changelog for you.
zalan
Comment 7 2019-01-31 16:08:29 PST
or prepare-ChangeLog -b 194073 if you prefer uploading patches manually.
Benjamin Poulain
Comment 8 2019-01-31 16:47:02 PST
(In reply to Tim Horton from comment #5) > Comment on attachment 360684 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=360684&action=review > > > Source/WTF/ChangeLog:4 > > + <rdar://problem/47692312> Hit testing functions optimizations > > + https://bugs.webkit.org/show_bug.cgi?id=194073 > > This is usually: > > Title > Bugzilla link > Radar link I just use the radar title as bug title. What's the easiest way to create bugzilla bug from radars?
Tim Horton
Comment 9 2019-01-31 16:50:19 PST
(In reply to Benjamin Poulain from comment #8) > (In reply to Tim Horton from comment #5) > > Comment on attachment 360684 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=360684&action=review > > > > > Source/WTF/ChangeLog:4 > > > + <rdar://problem/47692312> Hit testing functions optimizations > > > + https://bugs.webkit.org/show_bug.cgi?id=194073 > > > > This is usually: > > > > Title > > Bugzilla link > > Radar link > > I just use the radar title as bug title. What's the easiest way to create > bugzilla bug from radars? webkit-patch will make a bugzilla bug for you when you're uploading your patch
Benjamin Poulain
Comment 10 2019-01-31 16:56:02 PST
(In reply to Tim Horton from comment #9) > > I just use the radar title as bug title. What's the easiest way to create > > bugzilla bug from radars? > > webkit-patch will make a bugzilla bug for you when you're uploading your > patch What I always use.
Benjamin Poulain
Comment 11 2019-01-31 20:37:49 PST
Benjamin Poulain
Comment 12 2019-01-31 20:40:02 PST
(In reply to Benjamin Poulain from comment #4) > (In reply to Simon Fraser (smfr) from comment #3) > > Comment on attachment 360684 [details] > > Patch > > > > Do any of these really make measurable perf improvements? > > Oh yeah. > > Maybe not on your machine but on older CPUs that hurts. Most of it is getting rid of int<->float and int<->double conversion. That's where we bleed the most. I would expect ARM would benefit even more but I guess we do a lot less hit testing there.
Simon Fraser (smfr)
Comment 13 2019-01-31 20:41:48 PST
Comment on attachment 360823 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360823&action=review > Source/WebCore/page/FrameViewLayoutContext.h:96 > + RenderLayoutState* layoutState() const PURE_FUNCTION; What does PURE_FUNCTION do?
Simon Fraser (smfr)
Comment 14 2019-01-31 20:42:43 PST
(In reply to Benjamin Poulain from comment #12) > Most of it is getting rid of int<->float and int<->double conversion. That's > where we bleed the most. I bet we have TONS of LayoutRect <-> FloatRect <-> IntRect conversions in various places. Is there any way to find the hotspots?
Benjamin Poulain
Comment 15 2019-01-31 20:50:28 PST
(In reply to Simon Fraser (smfr) from comment #13) > Comment on attachment 360823 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=360823&action=review > > > Source/WebCore/page/FrameViewLayoutContext.h:96 > > + RenderLayoutState* layoutState() const PURE_FUNCTION; > > What does PURE_FUNCTION do? We tell the compiler that the return value only depends on its parameters, and global memory. AND that the function does not change the state of the program. Since we do not change the memory of FrameViewLayoutContext between the two calls, the compiler is allowed to reuse the value of the first call. The doc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes A good Stackoverflow: https://stackoverflow.com/questions/29117836/attribute-const-vs-attribute-pure-in-gnu-c > I bet we have TONS of LayoutRect <-> FloatRect <-> IntRect conversions in > various places. Is there any way to find the hotspots? I suspect you are right. I don't have an idea to find the bad ones though.
Benjamin Poulain
Comment 16 2019-02-01 18:44:22 PST
Benjamin Poulain
Comment 17 2019-02-01 18:45:10 PST
I added a fast int->unsigned since that was used in an API test. Also added some tests for the new functions.
Simon Fraser (smfr)
Comment 18 2019-02-02 11:50:08 PST
It's probably better to fork the clamp changes into their own bug (Darin might have opinions).
Darin Adler
Comment 19 2019-02-03 11:28:54 PST
I agree that we should separate out the clampTo fixes; I’d think we’d want to land them first, and then go on to the optimizations that are built on them. Even if it’s just for regression testing and future bisection if no other reason. I haven’t studied the behavior changes in clampTo yet -- I understand the principle but not the details of how the function needs to be used differently. I see many call sites changing and the regression tests alone don’t make it clear to me what changed about how it has to be used and what results you get. The idea of making it more efficient without changing behavior is fantastic. I almost wish that any changes on how it has to be used or implements in behavior could be separate from a patch that was purely about performance and didn’t require changes at call sites. That could take the form of a patch that changes call sites without affecting behavior or performance. Then another that affects performance without changing behavior. Or whatever sequence we can make like that. Again, better for later bisection to see if any problems were caused.
Benjamin Poulain
Comment 20 2019-02-03 11:33:54 PST
Sounds good. I'll make a separate clampTo() patch with better explanations and testing.
Benjamin Poulain
Comment 21 2019-02-04 21:06:30 PST
WebKit Commit Bot
Comment 22 2019-02-05 00:52:10 PST
Comment on attachment 361155 [details] Patch Clearing flags on attachment: 361155 Committed r240968: <https://trac.webkit.org/changeset/240968>
WebKit Commit Bot
Comment 23 2019-02-05 00:52:12 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.