On Wed, 12 Mar 2025 00:35:10 GMT, Nir Lisker <nlis...@openjdk.org> wrote:

>> modules/javafx.base/src/main/java/com/sun/javafx/binding/OldValueCachingListenerManager.java
>>  line 168:
>> 
>>> 166:      *   can be {@code null} which means there are no listeners to 
>>> notify
>>> 167:      */
>>> 168:     public void fireValueChanged(I instance, Object listenerData) {
>> 
>> Same comments. `null` check on `instance`?
>
> Is a switch expression on `listenerData` not suitable here?

This is a really hot code path, and the current version came out best in the 
benchmarks. I didn't try modify this one for that reason.  I did try for the 
`removeListener` code (as performance is irrelevant there), but it was a poor 
fit for `switch` (duplicate cases, duplicate code, and can't do fall through or 
multiple options with `when` expressions it seems...)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1081#discussion_r1990388631

Reply via email to