[
https://issues.apache.org/jira/browse/FLINK-3721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15234962#comment-15234962
]
ASF GitHub Bot commented on FLINK-3721:
---------------------------------------
Github user StephanEwen commented on the pull request:
https://github.com/apache/flink/pull/1866#issuecomment-208312329
Looks good. One optimization suggestion: Replace
```java
if (value > this.max) {
this.max = value;
}
```
by
```java
this.max = Math.max(this.max, value);
```
That is a branch-free variant, because (as far as I know) these Math
functions are JIT intrinsics and become special assembler instructions in the
end.
(See:
http://www.slideshare.net/RednaxelaFX/green-teajug-hotspotintrinsics02232013
and
http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/classfile/vmSymbols.hpp)
> Min and max accumulators
> ------------------------
>
> Key: FLINK-3721
> URL: https://issues.apache.org/jira/browse/FLINK-3721
> Project: Flink
> Issue Type: New Feature
> Components: Core
> Affects Versions: 1.1.0
> Reporter: Greg Hogan
> Assignee: Greg Hogan
> Priority: Minor
>
> Flink already contains {{DoubleCounter}}, {{IntCounter}}, and {{LongCounter}}
> for adding numbers. This will add equivalent accumulators for storing the
> minimum and maximum double, int, and long values.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)