RFR: 8309470: Potential performance improvements in VirtualFlow

Andy Goryachev angorya at openjdk.org
Thu Jun 8 00:04:01 UTC 2023


On Wed, 7 Jun 2023 20:59:01 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

> This PR does two small improvements to `VirtualFlow`.
> Until now, the `VirtualFlow` sometimes called the `computeHeight` or `computeWidth` methods, although a fixed cell size is set and we therefore don't need to call those method (and never should do, as we may don't get the expected result and mix computed sizes with the fixed cell size).
> 
> Added tests that fail before and pass now. They check that the `computeHeight` or `computeWidth` (non vertical flow) are never called when a fixed cell size is set.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 1954:

> 1952:      * Gets the breadth of a specific cell
> 1953:      */
> 1954:     double getCellBreadth(T cell) {

is there a possibility of introducing a runtime errors?

modules/javafx.controls/src/test/java/test/javafx/scene/control/skin/VirtualFlowTest.java line 1530:

> 1528:     @Test
> 1529:     public void testComputeHeightShouldNotBeCalledWhenFixedCellSizeIsSet() {
> 1530:         int cellSize = 24;

magic number.
cellSize=94 fails the test, unless line 1555 changed to `flow.resize(3000, 3000);`
cellSize=4 is ok.

modules/javafx.controls/src/test/java/test/javafx/scene/control/skin/VirtualFlowTest.java line 1579:

> 1577:     @Test
> 1578:     public void testComputeWidthShouldNotBeCalledWhenFixedCellSizeIsSet() {
> 1579:         int cellSize = 24;

magic number.  setting  cell size to 44 fails the test.  cellSize=4 is ok.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1150#discussion_r1222292196
PR Review Comment: https://git.openjdk.org/jfx/pull/1150#discussion_r1222269418
PR Review Comment: https://git.openjdk.org/jfx/pull/1150#discussion_r1222268654


More information about the openjfx-dev mailing list