RFR: 8325154: resizeColumnToFitContent is slower than it needs to be

Robert Lichtenberger rlichten at openjdk.org
Mon Feb 5 09:34:07 UTC 2024


On Fri, 2 Feb 2024 16:15:43 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> I see it working right in macOS 14.2.1, by double-clicking on the column divider in the table header.
> 
> Question to @effad : could you provide the measurements for this fix (before/after) please?

Applying the patch improves performance (on my Threadripper  2950X)from:
JFX 21.0.2+5 average run time: 2460
to:
JFX 23-internal+0-2024-02-01-061822 average run time: 1119 

so the speedup is quite remarkable and will probably be even better, if I follow @Maran23 advise to also pull `cell.updateTableRow(tableRow);` out of the loop. I will hopefully be able to provide an improved PR tomorrow.

> A side comment: the default implementation of resizeColumnToFitContent() is to iterate over all the rows, and I think this is not right. The UI locks up if the table has, let's say, 10,000,000 rows. I think in this case it should instead pick a reasonable limited range (maybe a max 1000 rows or so) of rows based on what's currently visible, so as not to lock up the UI. This might be a separate improvement.

I agree. However, in order to "not break things" we would have to introduce an API to users to be able to control the number of rows they want to be taken into account. Definitely a separate improvement.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1358#issuecomment-1926559011


More information about the openjfx-dev mailing list