Changeset 130456 in webkit


Ignore:
Timestamp:
Oct 4, 2012, 9:22:31 PM (13 years ago)
Author:
eric@webkit.org
Message:

SVGAttributeHashTranslator does not need to copy QualifiedName in the common case
https://bugs.webkit.org/show_bug.cgi?id=98473

Reviewed by Adam Barth.

I tested this using instruments on a test case which modified SVG attributes in a loop.
I believe pdr has some perf-tests in this area, but they weren't needed here. A simple sample showed this as a huge win,
since we're no longer creating a QualifiedName (and thus adding it to the hash) on each QualifiedName-based lookup in SVG.

  • svg/SVGElement.h:

(WebCore::SVGAttributeHashTranslator::hash):
(WebCore::SVGAttributeHashTranslator::equal):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130454 r130456  
     12012-10-04  Eric Seidel  <eric@webkit.org>
     2
     3        SVGAttributeHashTranslator does not need to copy QualifiedName in the common case
     4        https://bugs.webkit.org/show_bug.cgi?id=98473
     5
     6        Reviewed by Adam Barth.
     7
     8        I tested this using instruments on a test case which modified SVG attributes in a loop.
     9        I believe pdr has some perf-tests in this area, but they weren't needed here.  A simple sample showed this as a huge win,
     10        since we're no longer creating a QualifiedName (and thus adding it to the hash) on each QualifiedName-based lookup in SVG.
     11
     12        * svg/SVGElement.h:
     13        (WebCore::SVGAttributeHashTranslator::hash):
     14        (WebCore::SVGAttributeHashTranslator::equal):
     15
    1162012-10-04  Julien Chaffraix  <jchaffraix@webkit.org>
    217
  • trunk/Source/WebCore/svg/SVGElement.h

    r128009 r130456  
    158158
    159159struct SVGAttributeHashTranslator {
    160     static unsigned hash(QualifiedName key)
     160    static unsigned hash(const QualifiedName& key)
    161161    {
    162         key.setPrefix(nullAtom);
     162        if (key.hasPrefix())
     163            return DefaultHash<QualifiedName>::Hash::hash(QualifiedName(nullAtom, key.localName(), key.namespaceURI()));
    163164        return DefaultHash<QualifiedName>::Hash::hash(key);
    164165    }
    165     static bool equal(QualifiedName a, QualifiedName b) { return a.matches(b); }
     166    static bool equal(const QualifiedName& a, const QualifiedName& b) { return a.matches(b); }
    166167};
    167168
Note: See TracChangeset for help on using the changeset viewer.