From 93fc13e1c9c55bc7fce12fd20ef2917b726b7ae0 Mon Sep 17 00:00:00 2001 From: janakr Date: Sun, 5 Aug 2018 15:55:50 -0700 Subject: Use fact that the subgraph of ActionLookupValues has the same transitive dependency relations as the full graph to avoid descending into non-ActionLookupValue parts of the graph when collecting ActionLookupValues. PiperOrigin-RevId: 207472612 --- .../com/google/devtools/build/lib/skyframe/SkyframeBuildView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java index 9b879db1e7..a86d51a58f 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java @@ -798,7 +798,10 @@ public final class SkyframeBuildView { private static void findActionsRecursively( WalkableGraph walkableGraph, SkyKey key, Set seen, List result) throws InterruptedException { - if (!seen.add(key)) { + if (!(key instanceof ActionLookupValue.ActionLookupKey) || !seen.add(key)) { + // The subgraph of dependencies of ActionLookupValues never has a non-ActionLookupValue + // depending on an ActionLookupValue. So we can skip any non-ActionLookupValues in the + // traversal as an optimization. return; } SkyValue value = walkableGraph.getValue(key); -- cgit v1.2.3