RFR: Fix VirtualFlow performance regression in ListView scrolling

Huang Xiao duke at openjdk.org
Mon Jan 12 03:37:27 UTC 2026


On Sun, 11 Jan 2026 17:01:32 GMT, Huang Xiao <duke at openjdk.org> wrote:

> 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., 1000+ items). 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.
> 
> 
> <?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</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>3.11.0</version>
>                 <configuration>
>                     <source>${java.version}</source>
>                     <target>${java.version}</target>
>                 </configuration>
>             </plugin>
> 
>             
>             <plugin>
>                 <groupId>org.openjfx</groupId>
>                 <artifactId>javafx-maven-plugin</artifactId>
>                 <version>${...

I discovered that version 25 has performance issues locally, and it works fine when rolling back to version 24. I don't have sufficient permissions and also don't have a place to report this issue. The current workaround is to roll back to version 24. However, I'm not sure if this is a destructive change.

@Maran23 Hello, I noticed you've made contributions to this area before. Could you help me review this issue?

A relatively complete code example has been provided above. If you need a directly usable attachment, I can provide it.

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

PR Comment: https://git.openjdk.org/jfx/pull/2030#issuecomment-3736764476
PR Comment: https://git.openjdk.org/jfx/pull/2030#issuecomment-3736766299


More information about the openjfx-dev mailing list