Bug 122815 - Optimize RenderBlock::lowestFloatLogicalBottom by caching previously calculated values
Summary: Optimize RenderBlock::lowestFloatLogicalBottom by caching previously calculat...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Laszlo Vidacs
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2013-10-14 22:57 PDT by Ryosuke Niwa
Modified: 2016-09-17 07:15 PDT (History)
15 users (show)

See Also:


Attachments
Patch (10.79 KB, patch)
2014-03-10 09:58 PDT, Laszlo Vidacs
no flags Details | Formatted Diff | Diff
Patch (10.78 KB, patch)
2014-05-23 06:45 PDT, Laszlo Vidacs
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2013-10-14 22:57:19 PDT
Consider merging https://chromium.googlesource.com/chromium/blink/+/b0ba9a1ad19d5519cb03c3d42b38c3b8976e855e

This CL moves RenderBlock::lowestFloatLogicalBottom into FloatingObjects, and introduces a small cache to track the previously calculated lowestFloatLogicalBottom for each FloatingObject::type.

On my z620, this is ~25% faster on blink_perf's float_50_100 benchmark, and ~30% faster on android-gn. On oilevent from tough_layout_cases, this is about ~10% improvement.

Linux: 

Without patch: 
Avg floats_50_100: 255.006988ms 
Sd floats_50_100: 6.590191ms 

With patch: 
Avg floats_50_100: 189.995312ms 
Sd floats_50_100: 4.420704ms 


Android: 

Without patch: 
Avg floats_50_100: 6374.133600ms 
Sd floats_50_100: 852.598792ms 

With patch: 
Avg floats_50_100: 4205.389400ms 
Sd floats_50_100: 659.635617ms
Comment 1 Laszlo Vidacs 2014-03-10 09:58:00 PDT
Created attachment 226311 [details]
Patch
Comment 2 Laszlo Vidacs 2014-03-10 15:34:34 PDT
Average float_50_100 test results: ~317ms without patch vs ~287ms with patch -> ~10% better with patch (measured on efl port on pc)
Comment 3 Brent Fulgham 2014-04-16 13:57:18 PDT
Comment on attachment 226311 [details]
Patch

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

This looks like a good change, but I'd like some confirmation that we really want to switch from using an '&' test to the equality. Also, the naming scheme you've switched to is not acceptable.

> Source/WebCore/rendering/FloatingObjects.cpp:302
> +        for (FloatingObjectSet::const_iterator it = floatingObjectSet.begin(); it != end; ++it) {

This would read better as an 'auto'. The original code this is replacing was using auto previously.

> Source/WebCore/rendering/FloatingObjects.cpp:303
> +            const FloatingObject* r = it->get();

'floatingObject' is a much better name than 'r', and is what was used in the code you are replacing.

> Source/WebCore/rendering/FloatingObjects.cpp:317
> +        for (FloatingObjectSet::const_iterator it = floatingObjectSet.begin(); it != end; ++it) {

Ditto above (auto).

> Source/WebCore/rendering/FloatingObjects.cpp:318
> +            const FloatingObject* r = it->get();

Ditto above ('floatingObject' name).

> Source/WebCore/rendering/FloatingObjects.cpp:319
> +            if (r->isPlaced() && r->type() == floatType)

We used to use an '& floatType' test here. Why do we want equality now? Do we no longer need to handle the case where floatingObject->type() is a superset of types that encompasses 'floatType'?
Comment 4 Laszlo Vidacs 2014-05-23 06:45:17 PDT
Created attachment 231960 [details]
Patch
Comment 5 Csaba Osztrogonác 2014-12-03 04:56:12 PST
(In reply to comment #4)
> Created attachment 231960 [details]
> Patch

It seems László addressed the review comments. Brent?
Comment 6 Csaba Osztrogonác 2015-05-11 03:31:11 PDT
ping?
Comment 7 Simon Fraser (smfr) 2015-05-11 08:40:49 PDT
Comment on attachment 231960 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        Introduce a small cache to track previously calculated lowestFloatLogicalBottom values for FloatingObjects.
> +        Based on blink issue https://chromiumcodereview.appspot.com/23364008 by shatch.

What pages benefit from this cache? What is the memory cost? Can we add a performance test?
Comment 8 Michael Catanzaro 2016-09-17 07:15:37 PDT
Comment on attachment 231960 [details]
Patch

Hi,

Apologies that your patch was not reviewed in a timely manner. Since it's now quite old, I am removing it from the review request queue. Please consider rebasing it on trunk and resubmitting.

To increase the chances of getting a review, consider using 'Tools/Scripts/webkit-patch upload --suggest-reviewers' to CC reviewers who might be interested in this bug.