RESOLVED FIXED 100630
Make rendering tables with <colgroups> twice as fast by avoiding walking the DOM for colgroups 4 times for each cell
https://bugs.webkit.org/show_bug.cgi?id=100630
Summary Make rendering tables with <colgroups> twice as fast by avoiding walking the ...
Eric Seidel (no email)
Reported 2012-10-28 22:52:40 PDT
Make rendering tables with <colgroups> twice as fast by avoiding walking the DOM for colgroups 4 times for each cell
Attachments
Patch (7.92 KB, patch)
2012-10-28 22:57 PDT, Eric Seidel (no email)
no flags
Patch for landing (8.25 KB, patch)
2012-10-30 12:40 PDT, Eric Seidel (no email)
eric: commit-queue+
Eric Seidel (no email)
Comment 1 2012-10-28 22:57:08 PDT
Eric Seidel (no email)
Comment 2 2012-10-28 23:00:38 PDT
This is sadly not an algorithmic fix (it's lame that we even need to lookup these <colgroup> elements so often), it's just making these dumb lookups faster. Looking at the profile after this fix, we're still spending 21% of our time in slowColElement, we're just now walking this Vector instead of the DOM.
Ojan Vafai
Comment 3 2012-10-28 23:14:46 PDT
Comment on attachment 171160 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=171160&action=review Algorithmically, I wonder if you could save time by creating a colElementIterator class. Looks like at least some of the callers of colElement just iterate through the columns in order. Would be nice to not have to always start from the beginning of the list. Either way, this patch is fine. > Source/WebCore/rendering/RenderTable.cpp:792 > +RenderTableCol* RenderTable::slowColElement(unsigned col, bool* startEdge, bool* endEdge) const Not from your patch, but it seems silly to have a method called slowColElement when the only caller is in colElement which just does an early return and then calls this. May as well move the early return into this function and have this be colElement. I guess maybe colElement gets inlined?
Eric Seidel (no email)
Comment 4 2012-10-29 00:38:08 PDT
(In reply to comment #3) > (From update of attachment 171160 [details]) > Not from your patch, but it seems silly to have a method called slowColElement when the only caller is in colElement which just does an early return and then calls this. May as well move the early return into this function and have this be colElement. I guess maybe colElement gets inlined? Correct. I split slowColElement off of colElement in an earlier patch to allow the no-columns (common) case to be inline and fast. It was a big win on dglazkov's biggrid iirc.
WebKit Review Bot
Comment 5 2012-10-29 00:38:18 PDT
Comment on attachment 171160 [details] Patch Clearing flags on attachment: 171160 Committed r132764: <http://trac.webkit.org/changeset/132764>
WebKit Review Bot
Comment 6 2012-10-29 00:38:22 PDT
All reviewed patches have been landed. Closing bug.
Eric Seidel (no email)
Comment 7 2012-10-29 00:39:24 PDT
I do think some sort of state to prevent having to re-walk the columns every time would be useful. It's not yet clear to me what the access pattern of this data is yet.
Eric Seidel (no email)
Comment 8 2012-10-29 14:57:28 PDT
This fix may not be necessary in the end. If we can make collapsed borders not so expensive we won't need this complexity.
Eric Seidel (no email)
Comment 9 2012-10-30 12:40:11 PDT
Reopening to attach new patch.
Eric Seidel (no email)
Comment 10 2012-10-30 12:40:13 PDT
Created attachment 171503 [details] Patch for landing
Eric Seidel (no email)
Comment 11 2012-10-30 12:44:23 PDT
Sorry, got confused.
Note You need to log in before you can comment on or make changes to this bug.