> The commit 1b12c8a490 introduced two performance issues in VirtualFlow:
> 
> 1. Calling requestLayout() on all cells in the pile on every layout pass This 
> causes unnecessary layout calculations for 50-100 recycled cells per frame 
> during scrolling.
> 
> 2. Using sheetChildren.removeAll(pile) which has O(n*m) time complexity This 
> becomes extremely slow with large cell pools.
> 
> These changes caused severe scrolling lag in ListView/TableView with many 
> items (e.g., 100+ items, even less). The fix removes both problematic code 
> blocks while preserving the getViewportBreadth() visibility change needed by 
> TableRowSkinBase.
> 
> Tested with ListView containing 1000 items - scrolling is now smooth again, 
> matching JavaFX 24 performance.
> 
> The sample project has been uploaded:
> [demo-javafx.zip](https://github.com/user-attachments/files/24561207/demo-javafx.zip)
> 
> My system environment is:
> - Apple M1
> - macOS 26.2
> 
> Installed and used JDKs from the following vendors via SDKMAN:
> - 25.0.1-graalce
> - 25.0.1.fx-nik
> - 25.0.1-tem
> 
> Without exception, the lists are all somewhat laggy when scrolling. But if I 
> downgrade the FX version to 24, only "25.0.1.fx-nik" still shows lag — the 
> other two are very smooth!
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0";
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
>          http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>     <modelVersion>4.0.0</modelVersion>
> 
>     <groupId>com.example</groupId>
>     <artifactId>demo-javafx</artifactId>
>     <version>1.0-SNAPSHOT</version>
>     <packaging>jar</packaging>
> 
>     <name>JavaFX ListView Demo</name>
> 
>     <properties>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>         <java.version>25</java.version>
>         <javafx.version>25</javafx.version>
>         <javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version>
>     </properties>
> 
>     <dependencies>
>         
>         <dependency>
>             <groupId>org.openjfx</groupId>
>             <artifactId>javafx-controls</artifactId>
>             <version>${javafx.version}</version>
>         </dependency>
> 
>         
>         <dependency>
>             <groupId>org.openjfx</groupId>
>             <artifactId>javafx-fxml</artifactId>
>             <version>${javafx.version}</version>
>         </dependency>
>     </dependencies>
> 
>     <build>
>         <plugins>
>             
>             <plugin>
>                 <groupId>org.apache.maven.plugins</g...

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

  8185887: Fix VirtualFlow cleanPile to remove cells from sheetChildren
  
  The previous optimization of cleanPile() removed the 
sheetChildren.remove(cell)
  call to avoid O(n*m) complexity, but this caused test failures because
  pile cells were still present in sheetChildren (just invisible).
  
  This fix restores the sheetChildren.remove(cell) call but maintains
  O(n) complexity by removing cells individually within the pile loop
  rather than using removeAll(pile) which is O(n*m).
  
  This ensures:
  - sheetChildren only contains visible cells (test requirement)
  - O(n) time complexity (performance requirement)
  - Proper focus handling (accessibility requirement)

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/2030/files
  - new: https://git.openjdk.org/jfx/pull/2030/files/1733bfbc..43ff258b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=2030&range=03
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2030&range=02-03

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

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

Reply via email to