Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of many shadow trees with unique style triggers significant CPU usage and a rise in process size #18889

Merged

Commits on Oct 10, 2023

  1. Use of many shadow trees with unique style triggers significant CPU u…

    …sage and a rise in process size
    
    https://bugs.webkit.org/show_bug.cgi?id=260925
    rdar://114731415
    
    Reviewed by Alan Baradlay.
    
    Style resolver sharing cache in Style::Scope has unlimited size and the test case keeps adding more items
    there. Low memory handler clears the cache causing memory use to eventually drop.
    
    * Source/WebCore/dom/InlineStyleSheetOwner.cpp:
    (WebCore::InlineStyleSheetOwner::createSheet):
    
    Increase the size of the inline stylesheet sharing cache  (50 -> 256 items). Content that uses many unique
    shadow tree style (like this test) could overrun this smallish cache easily rendering it ineffective.
    
    Style resolver sharing in Style::Scope depends on inline stylesheet getting shared so this also made
    that cache work poorly.
    
    * Source/WebCore/style/StyleScope.cpp:
    (WebCore::Style::Scope::createOrFindSharedShadowTreeResolver):
    
    Add a limit to the resolver sharing cache size.
    
    Canonical link: https://commits.webkit.org/269142@main
    anttijk committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    b3c5d42 View commit details
    Browse the repository at this point in the history