Bug 129298

Summary: Optimize RenderTable::colToEffCol() for tables without colspans
Product: WebKit Reporter: Laszlo Vidacs <lvidacs.u-szeged>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dbates, esprehn+autocc, glenn, hyatt, kling, kondapallykalyan, lvidacs.u-szeged, rniwa
Priority: P2 Keywords: BlinkMergeCandidate
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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.