StefanRRichter opened a new pull request #8020: [FLINK-11980] Improve 
efficiency of iterating KeySelectionListener on notification
URL: https://github.com/apache/flink/pull/8020
 
 
   ## What is the purpose of the change
   
   `KeySelectionListener` was introduced for incremental TTL state cleanup as a 
driver of the cleanup process. Listeners are notified whenever the current key 
in the backend is set (i.e. for every event). The current implementation of the 
collection that holds the listener is a `HashSet`, iterated via `forEach` on 
each key change. This method comes with the overhead of creating temporaray 
objects, e.g. iterators, on every invocation and even if there is no listener 
registered. We should rather use an `ArrayList` with for-loop iteration in this 
hot code path to i) minimize overhead and ii) minimize costs for the very 
likely case that there is no listener at all.
   
   ## Brief change log
   
   Replaced `HashSet` with `ArrayList`. Using `for` loop instead of anything 
involving iterators.
   
   ## Verifying this change
   
   This change is a trivial rework / code cleanup without any test coverage.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to