WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
208343
Shrink-to-fit InlineFormattingContext
https://bugs.webkit.org/show_bug.cgi?id=208343
Summary
Shrink-to-fit InlineFormattingContext
Yusuke Suzuki
Reported
2020-02-27 14:42:59 PST
Shrink-to-fit InlineFormattingContext
Attachments
Patch
(4.29 KB, patch)
2020-02-27 16:41 PST
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(4.29 KB, patch)
2020-02-27 16:42 PST
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(4.48 KB, patch)
2020-02-27 17:57 PST
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch by Yusuke Suzuki
(7.41 KB, patch)
2020-02-27 21:09 PST
,
zalan
no flags
Details
Formatted Diff
Diff
Patch by Yusuke
(3.48 KB, patch)
2020-02-27 21:11 PST
,
zalan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2020-02-27 16:41:29 PST
Created
attachment 391941
[details]
Patch
Yusuke Suzuki
Comment 2
2020-02-27 16:42:53 PST
Created
attachment 391942
[details]
Patch
Yusuke Suzuki
Comment 3
2020-02-27 17:04:35 PST
I've inserted logging of actually used capacity, and run several web pages including Gmail, webkit.org, Speedometer. The result is large part of this is only 1. I think our inlineCapacity for Display::InlineContent is too large. Data collected from Speedometer2. RUNS 1 => 19257 2 => 4 3 => 2 4 => 4 5 => 1 LINEBOXES 1 => 19257 2 => 5 3 => 3 4 => 2 5 => 1 I think we should pick Vector<..., 1>.
Yusuke Suzuki
Comment 4
2020-02-27 17:04:51 PST
***
Bug 208350
has been marked as a duplicate of this bug. ***
Yusuke Suzuki
Comment 5
2020-02-27 17:14:15 PST
I'm now collecting PLT5's data.
zalan
Comment 6
2020-02-27 17:31:31 PST
Speedometer has a very specific and uncommon text content structure and I don't think we should optimize for this uncommon case. Normally we generate one (or a few) runs per line and a common paragraph (think of it as a section on a news page) has many lines of text. On live nytimes.com it averages over 2.1 for me. Apple.com has around 1.6 runs. Book content has an average over 10 for sure. Also keep in mind the low number is also an indication of low coverage of this feature which will change drastically very soon, so the number of runs will increase as well.
Yusuke Suzuki
Comment 7
2020-02-27 17:46:33 PST
This is PLT5 data. RUNS 1 => 6910 2 => 813 3 => 1306 4 => 546 5 => 175 6 => 145 7 => 43 8 => 5 9 => 39 17 => 16 LINEBOXES 1 => 6925 2 => 1517 3 => 587 4 => 546 5 => 175 6 => 145 7 => 43 8 => 5 9 => 39 17 => 16
Yusuke Suzuki
Comment 8
2020-02-27 17:52:38 PST
CDF from PLT5's data. To me, picking 4 sounds safe, it covers 95%. RUNS 1 => 6910, CDF 0.6911382276455291% 2 => 813, CDF 0.7724544908981796% 3 => 1306, CDF 0.9030806161232247% 4 => 546, CDF 0.9576915383076615% 5 => 175, CDF 0.9751950390078016% 6 => 145, CDF 0.9896979395879176% 7 => 43, CDF 0.993998799759952% 8 => 5, CDF 0.994498899779956% 9 => 39, CDF 0.9983996799359872% 17 => 16, CDF 1.0% LINEBOXES 1 => 6925, CDF 0.6926385277055411% 2 => 1517, CDF 0.844368873774755% 3 => 587, CDF 0.9030806161232247% 4 => 546, CDF 0.9576915383076615% 5 => 175, CDF 0.9751950390078016% 6 => 145, CDF 0.9896979395879176% 7 => 43, CDF 0.993998799759952% 8 => 5, CDF 0.994498899779956% 9 => 39, CDF 0.9983996799359872% 17 => 16, CDF 1.0%
zalan
Comment 9
2020-02-27 17:54:12 PST
(In reply to Yusuke Suzuki from
comment #8
)
> CDF from PLT5's data. To me, picking 4 sounds safe, it covers 95%. > > RUNS > 1 => 6910, CDF 0.6911382276455291% > 2 => 813, CDF 0.7724544908981796% > 3 => 1306, CDF 0.9030806161232247% > 4 => 546, CDF 0.9576915383076615% > 5 => 175, CDF 0.9751950390078016% > 6 => 145, CDF 0.9896979395879176% > 7 => 43, CDF 0.993998799759952% > 8 => 5, CDF 0.994498899779956% > 9 => 39, CDF 0.9983996799359872% > 17 => 16, CDF 1.0% > LINEBOXES > 1 => 6925, CDF 0.6926385277055411% > 2 => 1517, CDF 0.844368873774755% > 3 => 587, CDF 0.9030806161232247% > 4 => 546, CDF 0.9576915383076615% > 5 => 175, CDF 0.9751950390078016% > 6 => 145, CDF 0.9896979395879176% > 7 => 43, CDF 0.993998799759952% > 8 => 5, CDF 0.994498899779956% > 9 => 39, CDF 0.9983996799359872% > 17 => 16, CDF 1.0%
I am fine with 4 for not but please keep in mind we will increase this number over time.
Yusuke Suzuki
Comment 10
2020-02-27 17:57:28 PST
Created
attachment 391951
[details]
Patch
Yusuke Suzuki
Comment 11
2020-02-27 18:04:16 PST
(In reply to zalan from
comment #9
)
> (In reply to Yusuke Suzuki from
comment #8
) > > CDF from PLT5's data. To me, picking 4 sounds safe, it covers 95%. > > > > RUNS > > 1 => 6910, CDF 0.6911382276455291% > > 2 => 813, CDF 0.7724544908981796% > > 3 => 1306, CDF 0.9030806161232247% > > 4 => 546, CDF 0.9576915383076615% > > 5 => 175, CDF 0.9751950390078016% > > 6 => 145, CDF 0.9896979395879176% > > 7 => 43, CDF 0.993998799759952% > > 8 => 5, CDF 0.994498899779956% > > 9 => 39, CDF 0.9983996799359872% > > 17 => 16, CDF 1.0% > > LINEBOXES > > 1 => 6925, CDF 0.6926385277055411% > > 2 => 1517, CDF 0.844368873774755% > > 3 => 587, CDF 0.9030806161232247% > > 4 => 546, CDF 0.9576915383076615% > > 5 => 175, CDF 0.9751950390078016% > > 6 => 145, CDF 0.9896979395879176% > > 7 => 43, CDF 0.993998799759952% > > 8 => 5, CDF 0.994498899779956% > > 9 => 39, CDF 0.9983996799359872% > > 17 => 16, CDF 1.0% > > I am fine with 4 for not but please keep in mind we will increase this > number over time.
Right. For now, 4 looks a balanced number.
Yusuke Suzuki
Comment 12
2020-02-27 18:09:26 PST
Comment on
attachment 391951
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=391951&action=review
> Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp:136 > + formattingState().shrinkToFit();
Another design choice is calling this from low-memory-warning, but this sounds like a hack
Yusuke Suzuki
Comment 13
2020-02-27 18:16:04 PST
Another idea is adjusting this number at runtime. We can do that for growth factor etc. But here, we are changing initial-capacity to avoid any growth etc. And this is compile time number (because we do not want to allocate memory three times for each allocation of Display::InlineContent). So, we are now collecting the data AOT.
zalan
Comment 14
2020-02-27 18:20:15 PST
(In reply to Yusuke Suzuki from
comment #13
)
> Another idea is adjusting this number at runtime. We can do that for growth > factor etc. But here, we are changing initial-capacity to avoid any growth > etc. And this is compile time number (because we do not want to allocate > memory three times for each allocation of Display::InlineContent). So, we > are now collecting the data AOT.
I think having this constant value is okay for now. The patch however needs some work because: 1. shrinkToFit is an actual layout concept and calling this function like that is extremely confusing. 2. there's a better place for this call (outside of core layout) I can re-work this patch if you don't mind.
Yusuke Suzuki
Comment 15
2020-02-27 18:34:07 PST
(In reply to zalan from
comment #14
)
> (In reply to Yusuke Suzuki from
comment #13
) > > Another idea is adjusting this number at runtime. We can do that for growth > > factor etc. But here, we are changing initial-capacity to avoid any growth > > etc. And this is compile time number (because we do not want to allocate > > memory three times for each allocation of Display::InlineContent). So, we > > are now collecting the data AOT. > > I think having this constant value is okay for now. The patch however needs > some work because: > 1. shrinkToFit is an actual layout concept and calling this function like > that is extremely confusing. > 2. there's a better place for this call (outside of core layout) > I can re-work this patch if you don't mind.
You can do that :) Thanks
Radar WebKit Bug Importer
Comment 16
2020-02-27 21:04:02 PST
<
rdar://problem/59875758
>
zalan
Comment 17
2020-02-27 21:09:24 PST
Created
attachment 391959
[details]
Patch by Yusuke Suzuki
zalan
Comment 18
2020-02-27 21:11:35 PST
Created
attachment 391960
[details]
Patch by Yusuke
Antti Koivisto
Comment 19
2020-02-27 23:33:26 PST
Comment on
attachment 391960
[details]
Patch by Yusuke View in context:
https://bugs.webkit.org/attachment.cgi?id=391960&action=review
> Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp:114 > + m_inlineFormattingState.shrinkDisplayInlineContent();
Couldn’t this be done in generic IFC code?
zalan
Comment 20
2020-02-28 06:35:23 PST
(In reply to Antti Koivisto from
comment #19
)
> Comment on
attachment 391960
[details]
> Patch by Yusuke > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=391960&action=review
> > > Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp:114 > > + m_inlineFormattingState.shrinkDisplayInlineContent(); > > Couldn’t this be done in generic IFC code?
We need to come up with some strategy for shrinking formatting state data in general (for all the other formatting contexts) until then I think the integration layer is as good as any.
WebKit Commit Bot
Comment 21
2020-02-28 07:21:34 PST
Comment on
attachment 391960
[details]
Patch by Yusuke Clearing flags on attachment: 391960 Committed
r257637
: <
https://trac.webkit.org/changeset/257637
>
WebKit Commit Bot
Comment 22
2020-02-28 07:21:36 PST
All reviewed patches have been landed. Closing bug.
Yusuke Suzuki
Comment 23
2020-02-28 11:37:07 PST
Thanks Alan and Antti!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug