Bug 251700

Summary: DisplayList::ItemBuffer wastes a lot of vector capacity
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, heycam, simon.fraser, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Simon Fraser (smfr) 2023-02-03 10:29:01 PST
Using the patch in bug 186698, and testing on a wikipedia page, we see that DisplayList::ItemBuffer::ItemBuffer() wastes a lot of vector capacity:

Wasted capacity: 31632 bytes (used 0 of 31632 bytes, utilization: 0.00%) - 659 allocations
1   0x2fd3346e7 WTF::VectorBuffer<WebCore::DisplayList::ItemBufferHandle, 2ul, WTF::FastMalloc>::VectorBuffer()
2   0x2fd3313d1 WebCore::DisplayList::ItemBuffer::ItemBuffer()
3   0x2fd33119c WebCore::DisplayList::DisplayList::itemBuffer()
4   0x2fd3311fe WebCore::DisplayList::DisplayList::setItemBufferWritingClient(WebCore::DisplayList::ItemBufferWritingClient*)
5   0x2fd336a1b WebCore::DisplayList::InMemoryDisplayList::InMemoryDisplayList()
6   0x2fd30735a WebCore::FontCascade::displayListForTextRun(WebCore::GraphicsContext&, WebCore::TextRun const&, unsigned int, std::__1::optional<unsigned int>, WebCore::FontCascade::CustomFontNotReadyAction) const
7   0x2fcc5efd4 WebCore::GlyphDisplayListCache::get(void const*, WebCore::FontCascade const&, WebCore::GraphicsContext&, WebCore::TextRun const&)
8   0x2fcdf55a2 WebCore::TextBoxPainter<WebCore::InlineIterator::BoxModernPath>::paintForeground(WebCore::StyledMarkedText const&)
9   0x2fcdf3efe WebCore::TextBoxPainter<WebCore::InlineIterator::BoxModernPath>::paintForegroundAndDecorations()
10  0x2fcdf3656 WebCore::TextBoxPainter<WebCore::InlineIterator::BoxModernPath>::paint()
11  0x2fc7e0b49 WebCore::LayoutIntegration::InlineContentPainter::paintDisplayBox(WebCore::InlineDisplay::Box const&)
12  0x2fc7e0db5 WebCore::LayoutIntegration::InlineContentPainter::paint()
13  0x2fc7e54a8 WebCore::LayoutIntegration::LineLayout::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::RenderInline const*)
14  0x2fcc96d0e WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&)
Comment 1 Radar WebKit Bug Importer 2023-02-03 10:29:26 PST
<rdar://problem/105011333>
Comment 2 Simon Fraser (smfr) 2023-02-04 12:12:26 PST
Created attachment 464837 [details]
Patch
Comment 3 EWS 2023-02-04 17:07:17 PST
Committed 259861@main (b7a8c3d2ff89): <https://commits.webkit.org/259861@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 464837 [details].