Bug 100630 - Make rendering tables with <colgroups> twice as fast by avoiding walking the DOM for colgroups 4 times for each cell
Summary: Make rendering tables with <colgroups> twice as fast by avoiding walking the ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Seidel (no email)
URL:
Keywords:
Depends on:
Blocks: 100304
  Show dependency treegraph
 
Reported: 2012-10-28 22:52 PDT by Eric Seidel (no email)
Modified: 2012-10-30 12:44 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.92 KB, patch)
2012-10-28 22:57 PDT, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff
Patch for landing (8.25 KB, patch)
2012-10-30 12:40 PDT, Eric Seidel (no email)
eric: commit-queue+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 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
Comment 1 Eric Seidel (no email) 2012-10-28 22:57:08 PDT
Created attachment 171160 [details]
Patch
Comment 2 Eric Seidel (no email) 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.
Comment 3 Ojan Vafai 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?
Comment 4 Eric Seidel (no email) 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.
Comment 5 WebKit Review Bot 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>
Comment 6 WebKit Review Bot 2012-10-29 00:38:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Eric Seidel (no email) 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.
Comment 8 Eric Seidel (no email) 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.
Comment 9 Eric Seidel (no email) 2012-10-30 12:40:11 PDT
Reopening to attach new patch.
Comment 10 Eric Seidel (no email) 2012-10-30 12:40:13 PDT
Created attachment 171503 [details]
Patch for landing
Comment 11 Eric Seidel (no email) 2012-10-30 12:44:23 PDT
Sorry, got confused.