Description
This issue relates to James_D answer findings to "JavaFx tableview sort is really slow"
http://stackoverflow.com/questions/16805845/javafx-tableview-sort-is-really-slow-how-to-improve-sort-speed-as-in-java-swing
James_D's answer in the linked question also includes sample code to reproduce the issue. Comment out the property accessors (firstNameProperty(), lastNameProperty(), etc) in the sample to experience slow performance.
> In this example, the Person class doesn't have any property accessors (i.e. there's a getFirstName() method, but no firstNameProperty() method). Sorting by columns has to access the value in each cell in the column via the cell value factory. When there's no property accessor, the cell value factory is going to call getFirstName() and then wrap the result in a new ReadOnlyObjectWrapper on each invocation.
>
> If you make sure the class representing the row data has the appropriate property accessors, then retrieving the value is much more efficient, as it merely returns a reference to the existing StringProperty.
For 100K rows of random data, sorting without a property accessor took about 20 seconds on a 2012 MacBook Air (UI is frozen during that time). With property accessors supplied in the data model (or if you manually trigger Collection.sort on the underlying item list), the same sort executes in less than a second.
http://stackoverflow.com/questions/16805845/javafx-tableview-sort-is-really-slow-how-to-improve-sort-speed-as-in-java-swing
James_D's answer in the linked question also includes sample code to reproduce the issue. Comment out the property accessors (firstNameProperty(), lastNameProperty(), etc) in the sample to experience slow performance.
> In this example, the Person class doesn't have any property accessors (i.e. there's a getFirstName() method, but no firstNameProperty() method). Sorting by columns has to access the value in each cell in the column via the cell value factory. When there's no property accessor, the cell value factory is going to call getFirstName() and then wrap the result in a new ReadOnlyObjectWrapper on each invocation.
>
> If you make sure the class representing the row data has the appropriate property accessors, then retrieving the value is much more efficient, as it merely returns a reference to the existing StringProperty.
For 100K rows of random data, sorting without a property accessor took about 20 seconds on a 2012 MacBook Air (UI is frozen during that time). With property accessors supplied in the data model (or if you manually trigger Collection.sort on the underlying item list), the same sort executes in less than a second.