⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179917 in webkit


Ignore:
Timestamp:
Feb 10, 2015, 10:02:40 PM (12 years ago)
Author:
Chris Dumez
Message:

Optimize MutableStyleProperties::removePropertiesInSet()
https://bugs.webkit.org/show_bug.cgi?id=141460

Reviewed by Andreas Kling.

Optimize MutableStyleProperties::removePropertiesInSet() by doing an
in-place removal of the vector properties, using the new and efficient
Vector::removalAllMatching().

I see a ~11% speed-up on CSS/CSSPropertySetterGetter.html performance
test.

This change was inspired by the following Blink revision:
https://src.chromium.org/viewvc/blink?view=rev&revision=189387

Test: PerformanceTests/CSS/CSSPropertySetterGetter.html

  • css/StyleProperties.cpp:

(WebCore::MutableStyleProperties::removePropertiesInSet):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r179916 r179917  
     12015-02-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Optimize MutableStyleProperties::removePropertiesInSet()
     4        https://bugs.webkit.org/show_bug.cgi?id=141460
     5
     6        Reviewed by Andreas Kling.
     7
     8        Optimize MutableStyleProperties::removePropertiesInSet() by doing an
     9        in-place removal of the vector properties, using the new and efficient
     10        Vector::removalAllMatching().
     11
     12        I see a ~11% speed-up on CSS/CSSPropertySetterGetter.html performance
     13        test.
     14
     15        This change was inspired by the following Blink revision:
     16        https://src.chromium.org/viewvc/blink?view=rev&revision=189387
     17
     18        Test: PerformanceTests/CSS/CSSPropertySetterGetter.html
     19
     20        * css/StyleProperties.cpp:
     21        (WebCore::MutableStyleProperties::removePropertiesInSet):
     22
    1232015-02-10  Alex Christensen  <achristensen@webkit.org>
    224
  • trunk/Source/WebCore/css/StyleProperties.cpp

    r178586 r179917  
    11341134        toRemove.add(set[i]);
    11351135
    1136     Vector<CSSProperty> newProperties;
    1137     newProperties.reserveInitialCapacity(m_propertyVector.size());
    1138 
    1139     unsigned size = m_propertyVector.size();
    1140     for (unsigned n = 0; n < size; ++n) {
    1141         const CSSProperty& property = m_propertyVector.at(n);
     1136    return m_propertyVector.removeAllMatching([&toRemove] (const CSSProperty& property) {
    11421137        // Not quite sure if the isImportant test is needed but it matches the existing behavior.
    1143         if (!property.isImportant()) {
    1144             if (toRemove.contains(property.id()))
    1145                 continue;
    1146         }
    1147         newProperties.append(property);
    1148     }
    1149 
    1150     bool changed = newProperties.size() != m_propertyVector.size();
    1151     m_propertyVector = newProperties;
    1152     return changed;
     1138        return !property.isImportant() && toRemove.contains(property.id());
     1139    }) > 0;
    11531140}
    11541141
Note: See TracChangeset for help on using the changeset viewer.