azagrebin commented on a change in pull request #13422:
URL: https://github.com/apache/flink/pull/13422#discussion_r491870224
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/strategy/PipelinedRegionSchedulingStrategy.java
##########
@@ -127,13 +136,9 @@ private void maybeScheduleRegion(final
SchedulingPipelinedRegion region) {
checkState(areRegionVerticesAllInCreatedState(region), "BUG:
trying to schedule a region which is not in CREATED state");
- final Set<ExecutionVertexID> verticesToSchedule =
IterableUtils.toStream(region.getVertices())
- .map(SchedulingExecutionVertex::getId)
- .collect(Collectors.toSet());
final List<ExecutionVertexDeploymentOption>
vertexDeploymentOptions =
-
SchedulingStrategyUtils.createExecutionVertexDeploymentOptionsInTopologicalOrder(
- schedulingTopology,
- verticesToSchedule,
+
SchedulingStrategyUtils.createExecutionVertexDeploymentOptions(
Review comment:
should we also do this optimisation for other strategies to compare
performance in a cleaner way?
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/strategy/SchedulingStrategyUtils.java
##########
@@ -81,6 +82,14 @@
final SchedulingTopology topology,
final Set<SchedulingPipelinedRegion> regions) {
+ // Avoid the O(V) (V is the number of vertices in the topology)
sorting
+ // complexity if the given set of regions is small enough
+ if (regions.size() == 0) {
+ return Collections.emptyList();
+ } else if (regions.size() == 1) {
+ return
Collections.singletonList(regions.iterator().next());
+ }
+
return IterableUtils.toStream(topology.getVertices())
Review comment:
maybe we should also convert stream to a loop for performance in
`sortPipelinedRegionsInTopologicalOrder`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]