Bug 79591 - Avoid doing 2 hash lookups if we override RenderBox's logical width / height
Summary: Avoid doing 2 hash lookups if we override RenderBox's logical width / height
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Julien Chaffraix
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-25 18:36 PST by Julien Chaffraix
Modified: 2012-02-27 15:09 PST (History)
3 users (show)

See Also:


Attachments
Proposed refactoring. (6.61 KB, patch)
2012-02-25 18:49 PST, Julien Chaffraix
no flags Details | Formatted Diff | Diff
Smaller, better change. No change on html5-full-render.html this time. (1.49 KB, patch)
2012-02-27 13:22 PST, Julien Chaffraix
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2012-02-25 18:36:43 PST
Currently all RenderBoxes are calling clearOverrideSize. However a RenderBox could have an override size in only 3 cases:
* if it's a child of a RenderDeprecatedFlexibleBox
* if it's a child of a RenderFlexibleBox
* if it's a RenderTableCell

That would remove 2 hash lookups from RenderBox::willBeDestroyed.
Comment 1 Julien Chaffraix 2012-02-25 18:49:09 PST
Created attachment 128899 [details]
Proposed refactoring.
Comment 2 Benjamin Poulain 2012-02-25 19:09:37 PST
Comment on attachment 128899 [details]
Proposed refactoring.

View in context: https://bugs.webkit.org/attachment.cgi?id=128899&action=review

r~ from me :-D

> Source/WebCore/rendering/RenderBox.cpp:-251
> -    clearOverrideSize();
> -

I am not convinced by this change. You are spreading complexity to avoid one very simple call.
Could you find if this has any impact?

> Source/WebCore/rendering/RenderBox.cpp:802
> -    if (hasOverrideHeight())
> +    if (gOverrideHeightMap)
>          gOverrideHeightMap->remove(this);
> -    if (hasOverrideWidth())
> +    if (gOverrideWidthMap)
>          gOverrideWidthMap->remove(this);

This looks good.
Comment 3 Benjamin Poulain 2012-02-26 00:17:17 PST
Comment on attachment 128899 [details]
Proposed refactoring.

Let's r- until you benchmark it.
Comment 4 Julien Chaffraix 2012-02-27 12:54:25 PST
> Let's r- until you benchmark it.

Thanks for doubting my change. I tested on html5-full-renderer and it looks like it regressed a bit the benchmark (around 1%, small but significant). It looks like the branches we introduced were killing us and / or my assumption about the use of RenderDeprecatedFlexibleBox or RenderFlexibleBox were wrong.

I will re-purpose the bug to center around the good part and put a new patch for review.
Comment 5 Julien Chaffraix 2012-02-27 13:17:50 PST
Re-purposing the bug on the part that is safe.
Comment 6 Julien Chaffraix 2012-02-27 13:22:53 PST
Created attachment 129089 [details]
Smaller, better change. No change on html5-full-render.html this time.
Comment 7 Benjamin Poulain 2012-02-27 13:57:44 PST
Damn review thief! ;)
Comment 8 Antonio Gomes 2012-02-27 14:01:16 PST
(In reply to comment #7)
> Damn review thief! ;)

:'( ... <:o)
Comment 9 WebKit Review Bot 2012-02-27 15:09:51 PST
Comment on attachment 129089 [details]
Smaller, better change. No change on html5-full-render.html this time.

Clearing flags on attachment: 129089

Committed r109028: <http://trac.webkit.org/changeset/109028>
Comment 10 WebKit Review Bot 2012-02-27 15:09:56 PST
All reviewed patches have been landed.  Closing bug.