StephanEwen commented on issue #6544: [FLINK-8532] [Streaming] modify 
RebalancePartitioner to use a random partition as its first partition
URL: https://github.com/apache/flink/pull/6544#issuecomment-416043267
 
 
   Thanks for taking a deeper look. Unfortunately, divisions (modulo) are even 
more expensive, so would be good to avoid them.
   
   I think the solution can be actually a bit simpler. It would probably be 
sufficient to simply initialize the array to `INT_MAX - 1` replace the 
`this.returnArray[0] = 0;` in the original code with `this.returnArray[0] = 
resetValue()`. Inside the `resetValue()` you can do the initialization.
   
   That way, common cases have no additional check, and the overflow/reset case 
gets one additional branch, which is already a good improvement.
   
   We could possibly do a followup optimization, where outputs that have only 
one channel swap in a special selector that always returns just `0`. The 
one-channel-only case is probably the one that would be affected most by this 
change, because it always overflows each time.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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