je-ik commented on a change in pull request #12551:
URL: https://github.com/apache/beam/pull/12551#discussion_r470636567
##########
File path:
runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/DoFnOperator.java
##########
@@ -1226,7 +1227,7 @@ public TimerInternals timerInternals() {
* fire time of the timer. Used for calculating the output watermark hold.
This avoids fetching
* timer data from the state backend which is expensive if done for each
timer.
*/
- private final PriorityQueue<Long> outputTimestampQueue;
+ private final TreeMultiset<Long> outputTimestamps = TreeMultiset.create();
Review comment:
TreeMultiset does the same. And saves some code and performance, the
value is stored as array of length 1 and thus adding an already existing item
to the set is just get() and in-place increment, while the TreeMap must do get
& replace. I think the biggest argument here is that the code is more readable,
though. I'll update the PR in a sec, so that you can see.
----------------------------------------------------------------
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]