> When calling `refresh()` on virtualized Controls (`ListView`, `TreeView`, 
> `TableView`, `TreeTableView`), all cells will be recreated completely, 
> instead of just refreshing them.
> 
> This is because `recreateCells()` of the `VirtualFlow` is called when 
> `refresh()` was called. This is not needed, since refreshing the cells can be 
> done much cheaper with `rebuildCells()`.
> 
> This will reset all cells (`index = -1`), add them to the pile and fill them 
> back in the viewport with an index again. This ensures `updateItem()` is 
> called.
> 
> The contract of `refresh()` is also a big vague, stating:
> 
> Calling {@code refresh()} forces the XXX control to recreate and repopulate 
> the cells 
> necessary to populate the visual bounds of the control.
> In other words, this forces the XXX to update what it is showing to the user. 
> This is useful in cases where the underlying data source has changed in a way 
> that is not observed by the XXX itself.
> 
> 
> As written above, recreating is not needed in order to fulfull the contract 
> of updating what is shown to the user in case the underlying data source 
> changed without JavaFX noticing (e.g. calling a normal Setter without any 
> Property and therefore listener involved).
> 
> ----
> 
> Benchmarks
> -
> 
> Setup:
> - `TableView`
> - `100 TableColumns`
> - `1000 Items`
> 
> Code is in `tests/performance`.
> 
> Calling `refresh()` with a `Button` press.
> 
> | WHAT | BEFORE WITHOUT JDK-8360940 | BEFORE | WITH FIX | WITH FIX WITH 
> JDK-8370498 |
> | - | - | - | - | - |
> | Init | 0ms | 0 ms | 0 ms | 0 ms |
> | Init | 0ms | 0 ms | 0 ms | 0 ms |
> | Init | 195 ms | 209 ms | 211 ms | 217 ms |
> | Init | 42 ms | 47 ms | 41 ms | 10 ms |
> | Init | 2 ms | 6 ms | 6 ms | - |
> | Refresh Nr. 1 | 204 ms | 227 ms -> 23 ms -> 0 ms | 42 ms -> 0ms | 48 ms -> 
> 0ms |
> | Refresh Nr. 2 | 201 ms | 145 ms -> 27 ms -> 0 ms | 31 ms -> 0ms | 35 ms -> 
> 0ms |
> | Refresh Nr. 3 | 207 ms | 153 ms -> 25 ms | 33 ms -> 0ms | 31 ms -> 0ms |
> | Refresh Nr. 4 | 148 ms | 168 ms -> 20 ms -> 0 ms | 30 ms -> 0ms | 31 ms -> 
> 0ms |
> | Refresh Nr. 5 | 136 ms | 183 ms -> 31 ms -> 0 ms | 46 ms -> 0ms | 29 ms -> 
> 0ms |

Marius Hanl has updated the pull request incrementally with one additional 
commit since the last revision:

  add copyright

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/1830/files
  - new: https://git.openjdk.org/jfx/pull/1830/files/ba5a9bab..27ad53c7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1830&range=05
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1830&range=04-05

  Stats: 23 lines in 1 file changed: 23 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jfx/pull/1830.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1830/head:pull/1830

PR: https://git.openjdk.org/jfx/pull/1830

Reply via email to