Details
-
Bug
-
Resolution: Fixed
-
P3
-
8
Description
When you select a cell in a TableView, the ObservableList containing the selectedCells is updated.
Then, EACH TableCell in the TableView has its "selectedListener" reacting.
It's then calling "updateSelection();", and then calling "isSelected()".
And in that last method, you just go through the entire list of selectedCells to see whether that cell is selected or not.
I think it's pretty heavy. For example, if I maintain shift and select 500 cells, I'm can count that we're calling isSelected 20 000 times. And keep in mind that each call to that method induce going through the whole list of selectedCells which is itself becoming bigger each time we're adding a cell.
Do you have opinion on this? I would recommend to directly hit the selectedCell when selection in happening instead of having a listener on each cell. Because right now selection is very slow..
Another solution could be like the "selectAll" method. You could detect that a big selection with SHIFT is happening, And then just prepare all the cell to add, and just add them in one time in the list instead of calling "select()" for each one of them.
Then, EACH TableCell in the TableView has its "selectedListener" reacting.
It's then calling "updateSelection();", and then calling "isSelected()".
And in that last method, you just go through the entire list of selectedCells to see whether that cell is selected or not.
I think it's pretty heavy. For example, if I maintain shift and select 500 cells, I'm can count that we're calling isSelected 20 000 times. And keep in mind that each call to that method induce going through the whole list of selectedCells which is itself becoming bigger each time we're adding a cell.
Do you have opinion on this? I would recommend to directly hit the selectedCell when selection in happening instead of having a listener on each cell. Because right now selection is very slow..
Another solution could be like the "selectAll" method. You could detect that a big selection with SHIFT is happening, And then just prepare all the cell to add, and just add them in one time in the list instead of calling "select()" for each one of them.