RESOLVED FIXED 90059
Performance: Optimize Dromaeo/dom-query.html by caching NodeRareData on Document
https://bugs.webkit.org/show_bug.cgi?id=90059
Summary Performance: Optimize Dromaeo/dom-query.html by caching NodeRareData on Document
Kentaro Hara
Reported 2012-06-27 03:58:41 PDT
document.getElementsByClassName(), document.getElementsByTagName() and document.getElementsByName() are considered to be frequently used in the real world. Dromaeo/dom-query.html is also testing the performance of the three methods. We can optimize the performance by caching a pointer to NodeRareData on Document.
Attachments
Patch (5.12 KB, patch)
2012-06-27 04:01 PDT, Kentaro Hara
no flags
Patch (7.12 KB, patch)
2012-06-27 19:43 PDT, Kentaro Hara
no flags
patch for landing (7.23 KB, patch)
2012-06-27 21:55 PDT, Kentaro Hara
no flags
Kentaro Hara
Comment 1 2012-06-27 04:01:28 PDT
Kentaro Hara
Comment 2 2012-06-27 19:43:02 PDT
Ryosuke Niwa
Comment 3 2012-06-27 19:49:08 PDT
Comment on attachment 149856 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149856&action=review This seems like a good optimization. Make sure we're getting the same benefit for ElementRareData as things like document.images, document.all, etc... are all hanging out off ElementRareData as well. > Source/WebCore/dom/Document.h:437 > + NodeRareData* rareData() const { return m_rareData; }; > + void setRareData(NodeRareData*); Not sure if it's such a good idea to overload Node's rareData(). > Source/WebCore/dom/Node.cpp:500 > + NodeRareData* data = static_cast<Document*>(this)->rareData(); We should probably declare a Document* local variable.
Kentaro Hara
Comment 4 2012-06-27 19:51:50 PDT
Comment on attachment 149856 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149856&action=review >> Source/WebCore/dom/Document.h:437 >> + void setRareData(NodeRareData*); > > Not sure if it's such a good idea to overload Node's rareData(). What is your suggestion? (I thought that in IRC you suggested to rename cachedRareData() to rareData().) >> Source/WebCore/dom/Node.cpp:500 >> + NodeRareData* data = static_cast<Document*>(this)->rareData(); > > We should probably declare a Document* local variable. Will fix.
Kentaro Hara
Comment 5 2012-06-27 21:55:43 PDT
Created attachment 149865 [details] patch for landing
WebKit Review Bot
Comment 6 2012-06-27 23:29:42 PDT
Comment on attachment 149865 [details] patch for landing Clearing flags on attachment: 149865 Committed r121412: <http://trac.webkit.org/changeset/121412>
Note You need to log in before you can comment on or make changes to this bug.