Bug 129298 - Optimize RenderTable::colToEffCol() for tables without colspans
Summary: Optimize RenderTable::colToEffCol() for tables without colspans
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2014-02-25 04:19 PST by Laszlo Vidacs
Modified: 2014-03-20 16:17 PDT (History)
9 users (show)

See Also:


Attachments
Patch (10.72 KB, patch)
2014-03-03 08:42 PST, Laszlo Vidacs
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Laszlo Vidacs 2014-02-25 04:19:12 PST
colToEffCol() is very hot in tables with collapsed borders and
it is a very expensive function which iterates through every
column in the table up to the current one. But it only needs to
do this when the table's list of columns contains one whose
colspan exceeds the width of the table, as that is the only
situation in which |ColumnStruct| will still have a span.
(See RenderTableSection:addCell() where the span is
redistributed among other columns in the table during a
second pass of the table.)

Create a fast path for colToEffCol() and effColToCol() that
avoids iterating through every column unless the |m_columns|
vector still has a |ColumnStruct| with a span. The slow
path is extremely rare and probably not
worth optimizing for, as it only applies to tables
where a cell has a colspan that exceeds the total number of
columns provided by other rows in the table.

Blink merge candidate from https://chromium.googlesource.com/chromium/blink/+/dba71c7c3b953ef88b640bf32fa657fd2ebe4c63 by robhogan@gmail.com
Comment 1 Laszlo Vidacs 2014-03-03 08:42:19 PST
Created attachment 225656 [details]
Patch
Comment 2 Laszlo Vidacs 2014-03-04 07:35:59 PST
I made some performance measurements with the new test. Tests are extreme cases, but even on a virtual machine I could measure the difference (efl port):
collapsed-borders-and-no-colspans:               r164983: ~1700ms r164983-with-patch:  ~620 - ~64% better
collapsed-borders-and-colspans:                  r164983: ~1710ms r164983-with-patch:  ~640 - ~62% better
collapsed-borders-and-colspans-wider-than-table: r164983: ~1740ms r164983-with-patch: ~1710 - about the same
Comment 3 WebKit Commit Bot 2014-03-20 16:16:56 PDT
Comment on attachment 225656 [details]
Patch

Clearing flags on attachment: 225656

Committed r166016: <http://trac.webkit.org/changeset/166016>
Comment 4 WebKit Commit Bot 2014-03-20 16:17:01 PDT
All reviewed patches have been landed.  Closing bug.