Bug 74141 - REGRESSION(102234): 1% layout regression
Summary: REGRESSION(102234): 1% layout regression
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mihnea Ovidenie
URL:
Keywords:
Depends on: 74435 74537 74622 75007
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-08 17:03 PST by Tony Chang
Modified: 2012-01-04 10:22 PST (History)
2 users (show)

See Also:


Attachments
perf test (323.62 KB, application/octet-stream)
2011-12-08 17:04 PST, Tony Chang
no flags Details
First attempt (1.77 KB, patch)
2011-12-09 10:18 PST, Mihnea Ovidenie
no flags Details | Formatted Diff | Diff
Patch (1.90 KB, patch)
2011-12-09 15:21 PST, Tony Chang
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Chang 2011-12-08 17:03:17 PST
I'll upload a small perf test that shows the regression.  On my machine, it's about 6ms (2-3%) slower at r102360 then at r102234.
Comment 1 Tony Chang 2011-12-08 17:04:24 PST
Created attachment 118493 [details]
perf test
Comment 2 Tony Chang 2011-12-08 17:05:02 PST
Also, I tried just commenting out the if() in RenderObject::style(), but it didn't seem to help.  Maybe there's something else going on.
Comment 3 Mihnea Ovidenie 2011-12-09 04:17:28 PST
I have a possible fix for it, testing.
Comment 4 Mihnea Ovidenie 2011-12-09 10:18:51 PST
Created attachment 118592 [details]
First attempt
Comment 5 Mihnea Ovidenie 2011-12-09 14:12:54 PST
I will make some more tests before converting into a patch. According to Tony, this patch seems to solve the regression.
Comment 6 Tony Chang 2011-12-09 15:21:41 PST
Created attachment 118655 [details]
Patch
Comment 7 Dave Hyatt 2011-12-09 15:22:26 PST
Comment on attachment 118655 [details]
Patch

r=me
Comment 8 Tony Chang 2011-12-09 15:23:30 PST
Committed r102479: <http://trac.webkit.org/changeset/102479>
Comment 9 Tony Chang 2011-12-09 17:50:26 PST
Hmm, still didn't seem to matter. Maybe region is not null there?
Comment 10 Mihnea Ovidenie 2011-12-10 15:27:25 PST
(In reply to comment #9)
> Hmm, still didn't seem to matter. Maybe region is not null there?

(In reply to comment #9)
> Hmm, still didn't seem to matter. Maybe region is not null there?

I doubt that the region is not null. In my first attempt, i took the test for region null outside initForRegionStyling function. In the patch, you moved the test up in the function (thus saving the unnecessary allocation) but the call to the non-inline function is still performed. 

When you say it does not matter, you mean that you are getting 2-3% regression in the performance test you uploaded to the bug or in the chrome test suite?
Comment 11 Tony Chang 2011-12-10 17:34:26 PST
(In reply to comment #10)
> I doubt that the region is not null. In my first attempt, i took the test for region null outside initForRegionStyling function. In the patch, you moved the test up in the function (thus saving the unnecessary allocation) but the call to the non-inline function is still performed. 

You're right, it's always NULL in when there are no regions.

> When you say it does not matter, you mean that you are getting 2-3% regression in the performance test you uploaded to the bug or in the chrome test suite?

They're the same.  I just took the chrome test suite and took the 2 pages that showed the biggest time difference to make the test I uploaded.

Another idea is that adding the bit to RuleData increased the size of the class by a byte (there are 33 bits) is causing problems.
Comment 12 Tony Chang 2011-12-11 00:29:00 PST
I commented out the 'if' line in RenderObject::style() on the perf bot and it went back down to it's previous speed:

http://build.chromium.org/f/chromium/perf/vista-release-webkit-latest/moz/report.html?history=150&rev=-1

Since we have to do the 'if' check, we'll have to do what Hyatt suggested on IRC: find the places where we call style() frequently in Render* classes and use a local variable instead of making lots of calls.
Comment 13 Mihnea Ovidenie 2011-12-11 07:40:39 PST
(In reply to comment #12)
> I commented out the 'if' line in RenderObject::style() on the perf bot and it went back down to it's previous speed:
> 
> http://build.chromium.org/f/chromium/perf/vista-release-webkit-latest/moz/report.html?history=150&rev=-1
> 
> Since we have to do the 'if' check, we'll have to do what Hyatt suggested on IRC: find the places where we call style() frequently in Render* classes and use a local variable instead of making lots of calls.

Ok, i am taking a look to see what can we do in this direction.
Comment 14 Tony Chang 2011-12-13 11:35:52 PST
http://build.chromium.org/f/chromium/perf/xp-release-dual-core/moz/report.html?history=210&rev=114220

You can see where we regressed and there is a small drop on the right due to reverting the change in RenderObject::style() (chromium r114195 incorporated this change).

I think we still need to do more.  Maybe we can inline part of initForRegionStyling.
Comment 15 Tony Chang 2011-12-14 12:54:29 PST
Even with inlining part of initForRegionStyling, there's a tiny .8%-1.5% regression depending on which set of HTML pages are used.  It only shows up on our Windows test bot.

You can use shift+click on the graph and the lower right will show the percent diff.

About 1% slow: http://build.chromium.org/f/chromium/perf/vista-release-webkit-latest/moz/report.html?history=250&rev=114451

Not noticeable change: http://build.chromium.org/f/chromium/perf/mac-release-10.6-webkit-latest/moz/report.html?history=190&rev=114451

About 1.5% slow: http://build.chromium.org/f/chromium/perf/vista-release-webkit-latest/intl1/report.html?history=250&rev=114451

I'm going to make one more change to get rid of the call to initForRegionStyling to see if we can get back to our baseline.
Comment 16 Tony Chang 2011-12-15 10:14:53 PST
Removing the call to initForRegionStyling didn't change the perf results.  I'm going to roll it back in.

It's not clear to me if the remaining 1% was due to the original patch (r102234) or something else has crept in during the past week.  I guess we could try rolling out the original patch, but it might be easier at this point to just come up with the saving elsewhere.

This graph shows the regression most clearly:
http://build.chromium.org/f/chromium/perf/vista-release-webkit-latest/intl1/report.html?history=500&rev=114650
Comment 17 Mihnea Ovidenie 2011-12-15 10:28:02 PST
(In reply to comment #16)
> Removing the call to initForRegionStyling didn't change the perf results.  I'm going to roll it back in.
> 
> It's not clear to me if the remaining 1% was due to the original patch (r102234) or something else has crept in during the past week.  I guess we could try rolling out the original patch, but it might be easier at this point to just come up with the saving elsewhere.
> 
> This graph shows the regression most clearly:
> http://build.chromium.org/f/chromium/perf/vista-release-webkit-latest/intl1/report.html?history=500&rev=114650

Using a single call to RenderObject::style() shows some improvements on my machine. I want to use this way before rolling out the original patch.
Comment 18 Tony Chang 2012-01-04 10:22:10 PST
Since the original patch was rolled out, marking this as fixed.