Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
None
Description
Filtering a sortedlist in a TableView with 22K rows of data is extremely slow. It works fine with a few rows.
from javafx forum in OTN https://forums.oracle.com/thread/2589452
private final ObservableList<DataEntry> dataEntries = FXCollections.observableArrayList();
private final FilteredList<DataEntry> filteredDataEntries = new FilteredList(dataEntries);
private final SortedList sl_SortedDataEntries = new SortedList(filteredDataEntries);
private final TableView<DataEntry> dataTableView = new TableView<>();
public static RangeSlider dateRangeSlider = new RangeSlider(0,1,0,1);
Then, in my initialize() I set the following
dataTableView .setItems( sl_SortedDataEntries );
sl_SortedDataEntries.comparatorProperty().bind(dataTableView .comparatorProperty());
dateRangeSlider.lowValueProperty().addListener(new ChangeListener<Number>() { >>>> I do this for both the highValueProperty as well
@Override
public void changed (ObservableValue<? extends Number> message, Number oldValue, Number newValue) {
filteredDataEntries.setPredicate( p -> p.getDataEntryInstant().isAfter(Instant.ofEpochMilli(newValue.longValue()))
&& p.getDataEntryInstant().isBefore(Instant.ofEpochMilli(dateRangeSlider.highValueProperty().longValue())));
}
});
If I'm working on a TableView with 22K rows, I can filter the content of the TableView as desired (more or less) if I've not sorted the data. If the data is sorted, using the slider to filter it takes forever (5-10 min) for the computation to complete. Doing the filtering in it's own task, obviously takes care of that "app is hung" feeling but the data in the table still takes a while to refresh based on the new predicate.
from javafx forum in OTN https://forums.oracle.com/thread/2589452
private final ObservableList<DataEntry> dataEntries = FXCollections.observableArrayList();
private final FilteredList<DataEntry> filteredDataEntries = new FilteredList(dataEntries);
private final SortedList sl_SortedDataEntries = new SortedList(filteredDataEntries);
private final TableView<DataEntry> dataTableView = new TableView<>();
public static RangeSlider dateRangeSlider = new RangeSlider(0,1,0,1);
Then, in my initialize() I set the following
dataTableView .setItems( sl_SortedDataEntries );
sl_SortedDataEntries.comparatorProperty().bind(dataTableView .comparatorProperty());
dateRangeSlider.lowValueProperty().addListener(new ChangeListener<Number>() { >>>> I do this for both the highValueProperty as well
@Override
public void changed (ObservableValue<? extends Number> message, Number oldValue, Number newValue) {
filteredDataEntries.setPredicate( p -> p.getDataEntryInstant().isAfter(Instant.ofEpochMilli(newValue.longValue()))
&& p.getDataEntryInstant().isBefore(Instant.ofEpochMilli(dateRangeSlider.highValueProperty().longValue())));
}
});
If I'm working on a TableView with 22K rows, I can filter the content of the TableView as desired (more or less) if I've not sorted the data. If the data is sorted, using the slider to filter it takes forever (5-10 min) for the computation to complete. Doing the filtering in it's own task, obviously takes care of that "app is hung" feeling but the data in the table still takes a while to refresh based on the new predicate.
Attachments
Issue Links
- relates to
-
JDK-8091067 SortedList possible optimizations
-
- Open
-
-
JDK-8091262 FilteredList possible optimizations
-
- Open
-