Skip to content
  • svillar@igalia.com's avatar
    Use a Vector instead of HashSet to computed the orderValues in RenderFlexibleBox · a4099805
    svillar@igalia.com authored
    https://bugs.webkit.org/show_bug.cgi?id=118620
    
    Reviewed by Antti Koivisto.
    
    PerformanceTests:
    
    From Blink r152960 by <ojan@chromium.org>
    
    New performance test for layouts in flexboxes.
    
    * Layout/flexbox-lots-of-data.html: Added.
    
    Source/WebCore:
    
    Turns out that order is extremelly uncommon so using a Vector is
    much less expensive. This also special-cases the much common case
    of only having order of value 0 by using Vectors with just one
    preallocated member.
    
    Also added the performance test that shows a ~1% win when using a
    vector instead of the HashSet.
    
    * rendering/RenderFlexibleBox.cpp:
    (WebCore::RenderFlexibleBox::OrderIterator::setOrderValues):
    (WebCore::RenderFlexibleBox::layoutBlock):
    (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
    * rendering/RenderFlexibleBox.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a4099805