[ https://issues.apache.org/jira/browse/FLINK-2653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14802742#comment-14802742 ]
ASF GitHub Bot commented on FLINK-2653: --------------------------------------- Github user StephanEwen commented on the pull request: https://github.com/apache/flink/pull/1115#issuecomment-141041498 You are right, in those drivers, it is handled in the wrong way. Probably an artifact from the time before the `MultableObjectIterator` had both variants of the `next()` method. It used to have only the reusing variant. Clearly, this should be fixed. Here is the guide that I try to follow when working with the mutable objects: - All `MultableObjectIterator`s have two variants of the `next()` method - one for reuse, one without. - The variant without reuse it crucial, as not every situation can work with object reuse. - The variant with reuse is optional, but should be implemented where possible for performance. - The task drivers (AllReduceDriver, ...) or algorithms (sorter / hasher) know whether they want to work with reuse or not, and call the respective method in that case. > Enable object reuse in MergeIterator > ------------------------------------ > > Key: FLINK-2653 > URL: https://issues.apache.org/jira/browse/FLINK-2653 > Project: Flink > Issue Type: Improvement > Components: Distributed Runtime > Affects Versions: master > Reporter: Greg Hogan > > MergeIterator currently discards given reusable objects and simply returns a > new object from the JVM heap. This inefficiency has a noticeable impact on > garbage collection and runtime overhead (~5% overall performance by my > measure). -- This message was sent by Atlassian JIRA (v6.3.4#6332)