[
https://issues.apache.org/jira/browse/FLINK-8117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16261140#comment-16261140
]
ASF GitHub Bot commented on FLINK-8117:
---------------------------------------
Github user StephanEwen commented on the issue:
https://github.com/apache/flink/pull/5041
Very good change, and nice implementation!
+1 to merge this.
> 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
> Labels: performance
> Fix For: 1.5.0
>
>
> {{RoundRobinChannelSelector}}, {{RebalancePartitioner}}, and
> {{RescalePartitioner}} 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)