Gabor Gevay created FLINK-8117:
----------------------------------

             Summary: Eliminate modulo operation from RoundRobinChannelSelector 
and RebalancePartitioner
                 Key: FLINK-8117
                 URL: https://issues.apache.org/jira/browse/FLINK-8117
             Project: Flink
          Issue Type: Improvement
          Components: Local Runtime, Streaming
            Reporter: Gabor Gevay
            Assignee: Gabor Gevay
            Priority: Minor
             Fix For: 1.5.0


Both {{RoundRobinChannelSelector}} and {{RebalancePartitioner}} use a modulo 
operation to wrap around when the current channel counter reaches the number of 
channels. Using an {{if}} would have better performance.

A division with 32 bit operands is ~25 cycles on modern Intel CPUs \[1\], but 
the {{if}} will be only 1-2 cycles on average, since the branch predictor can 
most of the time predict the condition to be false.

\[1\] http://www.agner.org/optimize/instruction_tables.pdf



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to