Github user StephanEwen commented on a diff in the pull request:
https://github.com/apache/incubator-flink/pull/227#discussion_r20790380
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/HashPartition.java
---
@@ -297,9 +299,7 @@ public int spillPartition(List<MemorySegment> target,
IOManager ioAccess, FileIO
}
// return the memory from the overflow segments
- for (int i = 0; i < this.numOverflowSegments; i++) {
- target.add(this.overflowSegments[i]);
- }
+ target.addAll(Arrays.asList(this.overflowSegments).subList(0,
this.numOverflowSegments));
--- End diff --
The statement is again more efficient than the one below (which is somewhat
better readable).
I think it is good in this case, as the spillPartition() method is not part
of a an inner loop. Inside inner loops, I try to be very careful with such
operations, to keep object allocations and indirections to a minimum.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---