Changeset 62680 in webkit
- Timestamp:
- Jul 7, 2010 10:15:17 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r62678 r62680 1 2010-07-07 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Grease the TreeBuilder's lightning 6 https://bugs.webkit.org/show_bug.cgi?id=41756 7 8 Brings the new TreeBuilder from 7s to 3s on the parser benchmark. 9 This makes performance comparable to the old parser. 10 11 We have not begun to fight! There is so much fat left on these bones. 12 13 * html/HTMLFormattingElementList.cpp: 14 (WebCore::HTMLFormattingElementList::find): 15 (WebCore::HTMLFormattingElementList::bookmarkFor): 16 (WebCore::HTMLFormattingElementList::insertAt): 17 (WebCore::HTMLFormattingElementList::remove): 18 * html/HTMLFormattingElementList.h: 19 (WebCore::HTMLFormattingElementList::findIndex): 20 1 21 2010-07-07 Eric Seidel <eric@webkit.org> 2 22 -
trunk/WebCore/html/HTMLFormattingElementList.cpp
r62678 r62680 59 59 HTMLFormattingElementList::Entry* HTMLFormattingElementList::find(Element* element) 60 60 { 61 size_t index = m_entries.find(element);61 size_t index = findIndex(element); 62 62 if (index != notFound) { 63 63 // This is somewhat of a hack, and is why this method can't be const. … … 69 69 HTMLFormattingElementList::Bookmark HTMLFormattingElementList::bookmarkFor(Element* element) 70 70 { 71 size_t index = m_entries.find(element);71 size_t index = findIndex(element); 72 72 ASSERT(index != notFound); 73 73 Element* elementBefore = (index > 1) ? m_entries[index - 1].element() : 0; … … 80 80 size_t beforeIndex = notFound; 81 81 if (bookmark.elementBefore()) { 82 beforeIndex = m_entries.find(bookmark.elementBefore());82 beforeIndex = findIndex(bookmark.elementBefore()); 83 83 ASSERT(beforeIndex != notFound); 84 84 } 85 85 size_t afterIndex = notFound; 86 86 if (bookmark.elementAfter()) { 87 afterIndex = m_entries.find(bookmark.elementAfter());87 afterIndex = findIndex(bookmark.elementAfter()); 88 88 ASSERT(afterIndex != notFound); 89 89 } … … 110 110 void HTMLFormattingElementList::remove(Element* element) 111 111 { 112 size_t index = m_entries.find(element);112 size_t index = findIndex(element); 113 113 if (index != notFound) 114 114 m_entries.remove(index); -
trunk/WebCore/html/HTMLFormattingElementList.h
r62678 r62680 125 125 126 126 private: 127 size_t findIndex(Element* element) const 128 { 129 // A reverse find is more efficient than Vector<T>::find 130 for (size_t i = 1; i <= m_entries.size(); ++i) { 131 size_t index = m_entries.size() - i; 132 if (m_entries[index].element() == element) 133 return index; 134 } 135 return notFound; 136 } 127 137 Vector<Entry> m_entries; 128 138 };
Note: See TracChangeset
for help on using the changeset viewer.