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
Created attachment 225656 [details] Patch
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 on attachment 225656 [details] Patch Clearing flags on attachment: 225656 Committed r166016: <http://trac.webkit.org/changeset/166016>
All reviewed patches have been landed. Closing bug.