[ 
https://issues.apache.org/jira/browse/FLINK-8117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gabor Gevay updated FLINK-8117:
-------------------------------
    Description: 
{{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

  was:
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


> 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)

Reply via email to