RFR: 8359599: Calling refresh() for all virtualized controls recreates all cells instead of refreshing the cells [v2]

BlueGoliath duke at openjdk.org
Thu Oct 2 20:55:06 UTC 2025


On Thu, 2 Oct 2025 20:08:54 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> Marius Hanl has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>> 
>>  - Merge branch 'master' of https://github.com/openjdk/jfx into 8359599-refresh-recreates-all
>>  - Calling refresh() for all virtualized controls recreates all cells instead of refreshing the cells
>
> I did some benchmarks and attached them to the description. Results look very good and is expected from what I measured myself when I implemented that. 
> 
> Since we do not need to throw away all `TableRow`s and `TableCell`s, and then recreate them, we get a massive boost. Especially when we have many items (-> rows) and many columns. 
> If `TableCell`s have special logic, like showing a graphic or styling, this will be even bigger.

@Maran23 Not a developer but I'd just like to say thanks for this. For the longest time I thought it was because of lazy coding on my part(new `ReadOnlyObjectWrapper` instances instead of caching) but it turns out that even if you optimize your code, `TableView`'s `refresh `method *still* performs terribly.

I'd like also to point out that the terrible performance isn't just from having 100s of rows. Comparing the CPU usage difference between viewing many updating `Label`(s) at once vs a single `TableView` shows a CPU usage increase(0.01%-0.03%ish to 0.06%-0.08%ish) on relatively extremely powerful modern hardware with just about a dozen rows. 

But what's even worse is the garbage allocation rate. `TableView` in my application allocates entire MEGABYTES of garbage in an application that has a relatively low garbage allocation rate. This not only results in more GCs but could result in expanding the heap, resulting in more app memory usage.

Can this please get more attention?

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

PR Comment: https://git.openjdk.org/jfx/pull/1830#issuecomment-3362988887


More information about the openjfx-dev mailing list