<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>224158</bug_id>
          
          <creation_ts>2021-04-03 12:09:46 -0700</creation_ts>
          <short_desc>Lots of wasted vector capacity via InlineFormattingState</short_desc>
          <delta_ts>2021-04-07 12:29:40 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=224258</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=224296</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Fraser (smfr)">simon.fraser</reporter>
          <assigned_to name="alan">zalan</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>jonlee</cc>
    
    <cc>koivisto</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1746807</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-04-03 12:09:46 -0700</bug_when>
    <thetext>Using the patch in bug 186698 and testing on nytimes.com, vectors allocated under InlineFormattingState::InlineFormattingState waste lots of capacity (measured as live allocations with the page loaded):


Wasted capacity: 46656 bytes (used 23904 of 70560 bytes, utilization: 33.88%) - 49 allocations
5   0x3dccd979d WTF::VectorBuffer&lt;WebCore::Layout::LineBox, 10ul, WTF::FastMalloc&gt;::VectorBuffer()
6   0x3dccd9728 WTF::Vector&lt;WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
7   0x3dccb78d5 WTF::Vector&lt;WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
8   0x3dccb7857 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
9   0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
10  0x3dcc65a89 std::__1::__unique_if&lt;WebCore::Layout::InlineFormattingState&gt;::__unique_single std::__1::make_unique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
11  0x3dcc6595b decltype(auto) WTF::makeUnique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
12  0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)::$_11::operator()() const


Wasted capacity: 44496 bytes (used 11664 of 56160 bytes, utilization: 20.77%) - 39 allocations
5   0x3dccd979d WTF::VectorBuffer&lt;WebCore::Layout::LineBox, 10ul, WTF::FastMalloc&gt;::VectorBuffer()
6   0x3dccd9728 WTF::Vector&lt;WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
7   0x3dccb78d5 WTF::Vector&lt;WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
8   0x3dccb7857 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
9   0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
10  0x3dcc65a89 std::__1::__unique_if&lt;WebCore::Layout::InlineFormattingState&gt;::__unique_single std::__1::make_unique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
11  0x3dcc6595b decltype(auto) WTF::makeUnique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
12  0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)::$_11::operator()() const</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1746808</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-04-03 12:11:27 -0700</bug_when>
    <thetext>Also

Wasted capacity: 16480 bytes (used 93152 of 109632 bytes, utilization: 84.97%) - 49 allocations
5   0x3dccd95c6 WTF::VectorBuffer&lt;WebCore::Layout::InlineItem, 0ul, WTF::FastMalloc&gt;::VectorBuffer()
6   0x3dccd9588 WTF::Vector&lt;WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
7   0x3dccb7895 WTF::Vector&lt;WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
8   0x3dccb7833 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
9   0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
10  0x3dcc65a89 std::__1::__unique_if&lt;WebCore::Layout::InlineFormattingState&gt;::__unique_single std::__1::make_unique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1746809</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-04-03 12:12:02 -0700</bug_when>
    <thetext>Wasted capacity: 14656 bytes (used 5312 of 19968 bytes, utilization: 26.60%) - 39 allocations
5   0x3dccd95c6 WTF::VectorBuffer&lt;WebCore::Layout::InlineItem, 0ul, WTF::FastMalloc&gt;::VectorBuffer()
6   0x3dccd9588 WTF::Vector&lt;WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
7   0x3dccb7895 WTF::Vector&lt;WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
8   0x3dccb7833 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
9   0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
10  0x3dcc65a89 std::__1::__unique_if&lt;WebCore::Layout::InlineFormattingState&gt;::__unique_single std::__1::make_unique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
11  0x3dcc6595b decltype(auto) WTF::makeUnique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
12  0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)::$_11::operator()() const
13  0x3dcc5acf3 WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)
14  0x3dcce8ae3 WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&amp;)
15  0x3dcce8bed WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&amp;)
16  0x3dd8dd844 std::__1::__unique_if&lt;WebCore::LayoutIntegration::LineLayout&gt;::__unique_single std::__1::make_unique&lt;WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&amp;&gt;(WebCore::RenderBlockFlow&amp;)
17  0x3dd8c0016 decltype(auto) WTF::makeUnique&lt;WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&amp;&gt;(WebCore::RenderBlockFlow&amp;)
18  0x3dd8b0a90 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)
19  0x3dd8ae708 WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)
20  0x3dd8ad856 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
21  0x3dd895009 WebCore::RenderBlock::layout()
22  0x3dd7e74ec WebCore::RenderElement::layoutIfNeeded()

Wasted capacity: 12960 bytes (used 6640 of 19600 bytes, utilization: 33.88%) - 49 allocations
5   0x3dccd969d WTF::VectorBuffer&lt;WebCore::Layout::InlineLineGeometry, 10ul, WTF::FastMalloc&gt;::VectorBuffer()
6   0x3dccd9628 WTF::Vector&lt;WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
7   0x3dccb78b5 WTF::Vector&lt;WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
8   0x3dccb7845 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
9   0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
10  0x3dcc65a89 std::__1::__unique_if&lt;WebCore::Layout::InlineFormattingState&gt;::__unique_single std::__1::make_unique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
11  0x3dcc6595b decltype(auto) WTF::makeUnique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
12  0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)::$_11::operator()() const
13  0x3dcc5acf3 WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)
14  0x3dcce8ae3 WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&amp;)
15  0x3dcce8bed WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&amp;)
16  0x3dd8dd844 std::__1::__unique_if&lt;WebCore::LayoutIntegration::LineLayout&gt;::__unique_single std::__1::make_unique&lt;WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&amp;&gt;(WebCore::RenderBlockFlow&amp;)
17  0x3dd8c0016 decltype(auto) WTF::makeUnique&lt;WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&amp;&gt;(WebCore::RenderBlockFlow&amp;)
18  0x3dd8b0a90 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)
19  0x3dd8ae708 WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)
20  0x3dd8ad856 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
21  0x3dd895009 WebCore::RenderBlock::layout()
22  0x3dd8b0072 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&amp;, WebCore::RenderBlockFlow::MarginInfo&amp;, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)

Wasted capacity: 12360 bytes (used 3240 of 15600 bytes, utilization: 20.77%) - 39 allocations
5   0x3dccd969d WTF::VectorBuffer&lt;WebCore::Layout::InlineLineGeometry, 10ul, WTF::FastMalloc&gt;::VectorBuffer()
6   0x3dccd9628 WTF::Vector&lt;WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
7   0x3dccb78b5 WTF::Vector&lt;WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;::Vector()
8   0x3dccb7845 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
9   0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
10  0x3dcc65a89 std::__1::__unique_if&lt;WebCore::Layout::InlineFormattingState&gt;::__unique_single std::__1::make_unique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
11  0x3dcc6595b decltype(auto) WTF::makeUnique&lt;WebCore::Layout::InlineFormattingState, WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;, WebCore::Layout::LayoutState&amp;&gt;(WTF::Ref&lt;WebCore::Layout::FloatingState, WTF::RawPtrTraits&lt;WebCore::Layout::FloatingState&gt; &gt;&amp;&amp;, WebCore::Layout::LayoutState&amp;)
12  0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)::$_11::operator()() const
13  0x3dcc5acf3 WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&amp;)
14  0x3dcce8ae3 WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&amp;)
15  0x3dcce8bed WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&amp;)
16  0x3dd8dd844 std::__1::__unique_if&lt;WebCore::LayoutIntegration::LineLayout&gt;::__unique_single std::__1::make_unique&lt;WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&amp;&gt;(WebCore::RenderBlockFlow&amp;)
17  0x3dd8c0016 decltype(auto) WTF::makeUnique&lt;WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&amp;&gt;(WebCore::RenderBlockFlow&amp;)
18  0x3dd8b0a90 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)
19  0x3dd8ae708 WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&amp;, WebCore::LayoutUnit&amp;)
20  0x3dd8ad856 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit)
21  0x3dd895009 WebCore::RenderBlock::layout()
22  0x3dd7e74ec WebCore::RenderElement::layoutIfNeeded()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1746898</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-04-04 22:16:30 -0700</bug_when>
    <thetext>&lt;rdar://problem/76205829&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1747155</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2021-04-05 16:27:02 -0700</bug_when>
    <thetext>InlineFormattingState::shrinkToFit() needs to do m_inlineItems.shrinkToFit(), and InlineLines and InlineLineBoxes should not have inline capacity = 10.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>