RESOLVED CONFIGURATION CHANGED 224158
Lots of wasted vector capacity via InlineFormattingState
https://bugs.webkit.org/show_bug.cgi?id=224158
Summary Lots of wasted vector capacity via InlineFormattingState
Simon Fraser (smfr)
Reported 2021-04-03 12:09:46 PDT
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<WebCore::Layout::LineBox, 10ul, WTF::FastMalloc>::VectorBuffer() 6 0x3dccd9728 WTF::Vector<WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 7 0x3dccb78d5 WTF::Vector<WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 8 0x3dccb7857 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 9 0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 10 0x3dcc65a89 std::__1::__unique_if<WebCore::Layout::InlineFormattingState>::__unique_single std::__1::make_unique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 11 0x3dcc6595b decltype(auto) WTF::makeUnique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 12 0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&)::$_11::operator()() const Wasted capacity: 44496 bytes (used 11664 of 56160 bytes, utilization: 20.77%) - 39 allocations 5 0x3dccd979d WTF::VectorBuffer<WebCore::Layout::LineBox, 10ul, WTF::FastMalloc>::VectorBuffer() 6 0x3dccd9728 WTF::Vector<WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 7 0x3dccb78d5 WTF::Vector<WebCore::Layout::LineBox, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 8 0x3dccb7857 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 9 0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 10 0x3dcc65a89 std::__1::__unique_if<WebCore::Layout::InlineFormattingState>::__unique_single std::__1::make_unique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 11 0x3dcc6595b decltype(auto) WTF::makeUnique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 12 0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&)::$_11::operator()() const
Attachments
Simon Fraser (smfr)
Comment 1 2021-04-03 12:11:27 PDT
Also Wasted capacity: 16480 bytes (used 93152 of 109632 bytes, utilization: 84.97%) - 49 allocations 5 0x3dccd95c6 WTF::VectorBuffer<WebCore::Layout::InlineItem, 0ul, WTF::FastMalloc>::VectorBuffer() 6 0x3dccd9588 WTF::Vector<WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 7 0x3dccb7895 WTF::Vector<WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 8 0x3dccb7833 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 9 0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 10 0x3dcc65a89 std::__1::__unique_if<WebCore::Layout::InlineFormattingState>::__unique_single std::__1::make_unique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&)
Simon Fraser (smfr)
Comment 2 2021-04-03 12:12:02 PDT
Wasted capacity: 14656 bytes (used 5312 of 19968 bytes, utilization: 26.60%) - 39 allocations 5 0x3dccd95c6 WTF::VectorBuffer<WebCore::Layout::InlineItem, 0ul, WTF::FastMalloc>::VectorBuffer() 6 0x3dccd9588 WTF::Vector<WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 7 0x3dccb7895 WTF::Vector<WebCore::Layout::InlineItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 8 0x3dccb7833 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 9 0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 10 0x3dcc65a89 std::__1::__unique_if<WebCore::Layout::InlineFormattingState>::__unique_single std::__1::make_unique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 11 0x3dcc6595b decltype(auto) WTF::makeUnique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 12 0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&)::$_11::operator()() const 13 0x3dcc5acf3 WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&) 14 0x3dcce8ae3 WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&) 15 0x3dcce8bed WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&) 16 0x3dd8dd844 std::__1::__unique_if<WebCore::LayoutIntegration::LineLayout>::__unique_single std::__1::make_unique<WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&>(WebCore::RenderBlockFlow&) 17 0x3dd8c0016 decltype(auto) WTF::makeUnique<WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&>(WebCore::RenderBlockFlow&) 18 0x3dd8b0a90 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) 19 0x3dd8ae708 WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) 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<WebCore::Layout::InlineLineGeometry, 10ul, WTF::FastMalloc>::VectorBuffer() 6 0x3dccd9628 WTF::Vector<WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 7 0x3dccb78b5 WTF::Vector<WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 8 0x3dccb7845 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 9 0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 10 0x3dcc65a89 std::__1::__unique_if<WebCore::Layout::InlineFormattingState>::__unique_single std::__1::make_unique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 11 0x3dcc6595b decltype(auto) WTF::makeUnique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 12 0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&)::$_11::operator()() const 13 0x3dcc5acf3 WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&) 14 0x3dcce8ae3 WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&) 15 0x3dcce8bed WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&) 16 0x3dd8dd844 std::__1::__unique_if<WebCore::LayoutIntegration::LineLayout>::__unique_single std::__1::make_unique<WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&>(WebCore::RenderBlockFlow&) 17 0x3dd8c0016 decltype(auto) WTF::makeUnique<WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&>(WebCore::RenderBlockFlow&) 18 0x3dd8b0a90 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) 19 0x3dd8ae708 WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) 20 0x3dd8ad856 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) 21 0x3dd895009 WebCore::RenderBlock::layout() 22 0x3dd8b0072 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) Wasted capacity: 12360 bytes (used 3240 of 15600 bytes, utilization: 20.77%) - 39 allocations 5 0x3dccd969d WTF::VectorBuffer<WebCore::Layout::InlineLineGeometry, 10ul, WTF::FastMalloc>::VectorBuffer() 6 0x3dccd9628 WTF::Vector<WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 7 0x3dccb78b5 WTF::Vector<WebCore::Layout::InlineLineGeometry, 10ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>::Vector() 8 0x3dccb7845 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 9 0x3dccb7925 WebCore::Layout::InlineFormattingState::InlineFormattingState(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 10 0x3dcc65a89 std::__1::__unique_if<WebCore::Layout::InlineFormattingState>::__unique_single std::__1::make_unique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 11 0x3dcc6595b decltype(auto) WTF::makeUnique<WebCore::Layout::InlineFormattingState, WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >, WebCore::Layout::LayoutState&>(WTF::Ref<WebCore::Layout::FloatingState, WTF::RawPtrTraits<WebCore::Layout::FloatingState> >&&, WebCore::Layout::LayoutState&) 12 0x3dcc5c5ab WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&)::$_11::operator()() const 13 0x3dcc5acf3 WebCore::Layout::LayoutState::ensureInlineFormattingState(WebCore::Layout::ContainerBox const&) 14 0x3dcce8ae3 WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&) 15 0x3dcce8bed WebCore::LayoutIntegration::LineLayout::LineLayout(WebCore::RenderBlockFlow&) 16 0x3dd8dd844 std::__1::__unique_if<WebCore::LayoutIntegration::LineLayout>::__unique_single std::__1::make_unique<WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&>(WebCore::RenderBlockFlow&) 17 0x3dd8c0016 decltype(auto) WTF::makeUnique<WebCore::LayoutIntegration::LineLayout, WebCore::RenderBlockFlow&>(WebCore::RenderBlockFlow&) 18 0x3dd8b0a90 WebCore::RenderBlockFlow::layoutModernLines(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) 19 0x3dd8ae708 WebCore::RenderBlockFlow::layoutInlineChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&) 20 0x3dd8ad856 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) 21 0x3dd895009 WebCore::RenderBlock::layout() 22 0x3dd7e74ec WebCore::RenderElement::layoutIfNeeded()
Radar WebKit Bug Importer
Comment 3 2021-04-04 22:16:30 PDT
Simon Fraser (smfr)
Comment 4 2021-04-05 16:27:02 PDT
InlineFormattingState::shrinkToFit() needs to do m_inlineItems.shrinkToFit(), and InlineLines and InlineLineBoxes should not have inline capacity = 10.
Note You need to log in before you can comment on or make changes to this bug.