From 6ae05b419922193c4c253e51c9a5e483e4f947fa Mon Sep 17 00:00:00 2001 From: janakr Date: Mon, 13 Aug 2018 16:13:42 -0700 Subject: Order Skyframe evaluations in a priority queue, with all children of a given node having the same priority, later enqueueings having higher priority, re-enqueued nodes having highest priority, and new root nodes having lowest priority. Experimentally, this can save significant RAM (1.4G in some builds!) while not affecting speed. Also do a semi-drive-by deleting ExecutorFactory parameter to AbstractQueueVisitor, since it was always AbstractQueueVisitor.EXECUTOR_FACTORY. PiperOrigin-RevId: 208560889 --- .../devtools/build/skyframe/EagerInvalidator.java | 44 ++++------------------ 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java') diff --git a/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java b/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java index 3577230e3a..27e6b61ceb 100644 --- a/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java +++ b/src/main/java/com/google/devtools/build/skyframe/EagerInvalidator.java @@ -13,14 +13,9 @@ // limitations under the License. package com.google.devtools.build.skyframe; -import com.google.common.base.Function; -import com.google.devtools.build.lib.concurrent.AbstractQueueVisitor; -import com.google.devtools.build.lib.concurrent.ErrorHandler; -import com.google.devtools.build.lib.concurrent.ExecutorParams; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DeletingNodeVisitor; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.DirtyingNodeVisitor; import com.google.devtools.build.skyframe.InvalidatingNodeVisitor.InvalidationState; -import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; import javax.annotation.Nullable; @@ -73,11 +68,9 @@ public final class EagerInvalidator { QueryableGraph graph, Iterable diff, DirtyTrackingProgressReceiver progressReceiver, - InvalidationState state, - Function executorFactory) { + InvalidationState state) { state.update(diff); - return state.isEmpty() ? null - : new DirtyingNodeVisitor(graph, progressReceiver, state, executorFactory); + return state.isEmpty() ? null : new DirtyingNodeVisitor(graph, progressReceiver, state); } @Nullable @@ -87,8 +80,7 @@ public final class EagerInvalidator { DirtyTrackingProgressReceiver progressReceiver, InvalidationState state, ForkJoinPool forkJoinPool, - boolean supportInterruptions, - ErrorHandler errorHandler) { + boolean supportInterruptions) { state.update(diff); return state.isEmpty() ? null @@ -99,20 +91,15 @@ public final class EagerInvalidator { forkJoinPool, supportInterruptions); } - /** - * Invalidates given values and their upward transitive closure in the graph if necessary, using - * an executor constructed with the provided factory. - */ + /** Invalidates given values and their upward transitive closure in the graph if necessary. */ public static void invalidate( QueryableGraph graph, Iterable diff, DirtyTrackingProgressReceiver progressReceiver, - InvalidationState state, - Function executorFactory) + InvalidationState state) throws InterruptedException { DirtyingNodeVisitor visitor = - createInvalidatingVisitorIfNeeded( - graph, diff, progressReceiver, state, executorFactory); + createInvalidatingVisitorIfNeeded(graph, diff, progressReceiver, state); if (visitor != null) { visitor.run(); } @@ -132,26 +119,9 @@ public final class EagerInvalidator { throws InterruptedException { DirtyingNodeVisitor visitor = createInvalidatingVisitorIfNeeded( - graph, - diff, - progressReceiver, - state, - forkJoinPool, - supportInterruptions, - ErrorHandler.NullHandler.INSTANCE); + graph, diff, progressReceiver, state, forkJoinPool, supportInterruptions); if (visitor != null) { visitor.run(); } } - - /** Invalidates given values and their upward transitive closure in the graph. */ - public static void invalidate( - QueryableGraph graph, - Iterable diff, - DirtyTrackingProgressReceiver progressReceiver, - InvalidationState state) - throws InterruptedException { - invalidate(graph, diff, progressReceiver, state, AbstractQueueVisitor.EXECUTOR_FACTORY); - } - } -- cgit v1.2.3