RFR: 8252936: Optimize removal of listeners from ExpressionHelper.Generic

Kevin Rushforth kcr at openjdk.java.net
Fri Mar 5 16:05:58 UTC 2021


On Sat, 22 Feb 2020 08:42:52 GMT, yosbits <github.com+7517141+yososs at openjdk.org> wrote:

>> @kevinrushforth just a note to say there are other ExpressionHelper classes (i.e. MapExpressionHelper, SetExpressionHelper and ListExpressionHelper) that also use arrays and suffer from the linear search issue when removing listeners. 
>> 
>> These however didn't appear in the critical path of the JavaFXThread and didn't come up in my profiling of TableView.
>> 
>> If this pull request is accepted, my opinion is that they should probably all move to using the same pattern as here, which is to use Maps instead of Arrays for their listener lists so that all these classes are uniform.
>> 
>> Thanks
>
> Sorry for the interruption, send a PR that corrects the same problem.

I haven't done a detailed review yet, but I worry about the memory consumption and performance of using a Map for the simple cases where there is only a single (or very small number) of listeners. These methods are used in many more places than just the TableView / TreeTableView implementation.

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

PR: https://git.openjdk.java.net/jfx/pull/108


More information about the openjfx-dev mailing list