Changeset 62678 in webkit


Ignore:
Timestamp:
Jul 7, 2010 10:11:28 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-07-07 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

HTMLTreeBuilder is way too slow
https://bugs.webkit.org/show_bug.cgi?id=41754

This takes us from 14s to 7s on our parsing benchmark.
That's still much slower than the old tree builder, but there
is a huge amount of fat left to trim.

Vector<T> wasn't able to inline all the Entry functions when
they were buried in the cpp. Turns out the active formatting elements
list is very hot.

I'm not sure Vector<T> is going to be the right data structure for us
in the end, but it has done alright for bring-up.

  • html/HTMLFormattingElementList.cpp:
  • html/HTMLFormattingElementList.h: (WebCore::HTMLFormattingElementList::Entry::Entry): (WebCore::HTMLFormattingElementList::Entry::~Entry): (WebCore::HTMLFormattingElementList::Entry::isMarker): (WebCore::HTMLFormattingElementList::Entry::element): (WebCore::HTMLFormattingElementList::Entry::replaceElement): (WebCore::HTMLFormattingElementList::Entry::operator==): (WebCore::HTMLFormattingElementList::Entry::operator!=):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r62677 r62678  
     12010-07-07  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        HTMLTreeBuilder is way too slow
     6        https://bugs.webkit.org/show_bug.cgi?id=41754
     7
     8        This takes us from 14s to 7s on our parsing benchmark.
     9        That's still much slower than the old tree builder, but there
     10        is a huge amount of fat left to trim.
     11
     12        Vector<T> wasn't able to inline all the Entry functions when
     13        they were buried in the cpp.  Turns out the active formatting elements
     14        list is very hot.
     15
     16        I'm not sure Vector<T> is going to be the right data structure for us
     17        in the end, but it has done alright for bring-up.
     18
     19        * html/HTMLFormattingElementList.cpp:
     20        * html/HTMLFormattingElementList.h:
     21        (WebCore::HTMLFormattingElementList::Entry::Entry):
     22        (WebCore::HTMLFormattingElementList::Entry::~Entry):
     23        (WebCore::HTMLFormattingElementList::Entry::isMarker):
     24        (WebCore::HTMLFormattingElementList::Entry::element):
     25        (WebCore::HTMLFormattingElementList::Entry::replaceElement):
     26        (WebCore::HTMLFormattingElementList::Entry::operator==):
     27        (WebCore::HTMLFormattingElementList::Entry::operator!=):
     28
    1292010-07-06  Darin Adler  <darin@apple.com>
    230
  • trunk/WebCore/html/HTMLFormattingElementList.cpp

    r62642 r62678  
    3131
    3232namespace WebCore {
    33 
    34 HTMLFormattingElementList::Entry::Entry(Element* element)
    35     : m_element(element)
    36 {
    37     ASSERT(element);
    38 }
    39 
    40 HTMLFormattingElementList::Entry::Entry(MarkerEntryType)
    41 {
    42 }
    43 
    44 HTMLFormattingElementList::Entry::~Entry()
    45 {
    46 }
    47 
    48 bool HTMLFormattingElementList::Entry::isMarker() const
    49 {
    50     return !m_element;
    51 }
    52 
    53 Element* HTMLFormattingElementList::Entry::element() const
    54 {
    55     // The fact that !m_element == isMarker() is an implementation detail
    56     // callers should check isMarker() before calling element().
    57     ASSERT(m_element);
    58     return m_element.get();
    59 }
    60 
    61 void HTMLFormattingElementList::Entry::replaceElement(PassRefPtr<Element> element)
    62 {
    63     ASSERT(m_element); // Once a marker, always a marker.
    64     m_element = element;
    65 }
    66 
    67 bool HTMLFormattingElementList::Entry::operator==(const Entry& other) const
    68 {
    69     return m_element == other.m_element;
    70 }
    71 
    72 bool HTMLFormattingElementList::Entry::operator!=(const Entry& other) const
    73 {
    74     return m_element != other.m_element;
    75 }
    7633
    7734HTMLFormattingElementList::HTMLFormattingElementList()
  • trunk/WebCore/html/HTMLFormattingElementList.h

    r62642 r62678  
    4747    class Entry {
    4848    public:
    49         Entry(Element*);
     49        // Inline because they're hot and Vector<T> uses them.
     50        Entry(Element* element)
     51            : m_element(element)
     52        {
     53            ASSERT(element);
     54        }
    5055        enum MarkerEntryType { MarkerEntry };
    51         Entry(MarkerEntryType);
    52         ~Entry();
     56        Entry(MarkerEntryType)
     57            : m_element(0)
     58        {
     59        }
     60        ~Entry() {}
    5361
    54         bool isMarker() const;
     62        bool isMarker() const { return !m_element; }
    5563
    56         Element* element() const;
    57         void replaceElement(PassRefPtr<Element>);
     64        Element* element() const
     65        {
     66            // The fact that !m_element == isMarker() is an implementation detail
     67            // callers should check isMarker() before calling element().
     68            ASSERT(m_element);
     69            return m_element.get();
     70        }
     71        void replaceElement(PassRefPtr<Element> element) { m_element = element; }
    5872
    59         // Needed for use with Vector.
    60         bool operator==(const Entry&) const;
    61         bool operator!=(const Entry&) const;
     73        // Needed for use with Vector.  These are super-hot and must be inline.
     74        bool operator==(const Entry& other) const { return m_element == other.m_element; }
     75        bool operator!=(const Entry& other) const { return m_element != other.m_element; }
    6276
    6377    private:
Note: See TracChangeset for help on using the changeset viewer.