aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2015-10-06 01:00:47 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2015-10-06 07:04:13 +0000
commit3a509bdb1fd842f66b2efe75d6c619605904f8aa (patch)
tree885f66b47606fcd6ef3de2a7d874b9b74036dd63 /src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java
parente1b61d0d8a0b2bb7d2984f4aa3bd2b20c426f634 (diff)
In FilesystemValueChecker, use 200 threads and don't waste threads on skipped keys. This yields some noticeable improvements for the wall times of null builds with even a small set of files to be checked for changes.
-- MOS_MIGRATED_REVID=104717653
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java
index 9a24122d3a..8fa15e1282 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyValueDirtinessChecker.java
@@ -13,7 +13,6 @@
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
-import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor;
import com.google.devtools.build.skyframe.SkyKey;
@@ -27,36 +26,26 @@ import javax.annotation.Nullable;
*/
public abstract class SkyValueDirtinessChecker {
+ /** Returns {@code true} iff the checker can handle {@code key}. */
+ public abstract boolean applies(SkyKey key);
+
/**
- * Returns
- * <ul>
- * <li>{@code null}, if the checker can't handle {@code key}.
- * <li>{@code Optional.<SkyValue>absent()} if the checker can handle {@code key} but was unable
- * to create a new value.
- * <li>{@code Optional.<SkyValue>of(v)} if the checker can handle {@code key} and the new value
- * should be {@code v}.
- * </ul>
+ * If {@code applies(key)}, returns the new value for {@code key} or {@code null} if the checker
+ * was unable to create a new value.
*/
@Nullable
- public abstract Optional<SkyValue> maybeCreateNewValue(SkyKey key,
- TimestampGranularityMonitor tsgm);
+ public abstract SkyValue createNewValue(SkyKey key, TimestampGranularityMonitor tsgm);
/**
- * Returns the result of checking whether this key's value is up to date, or null if this
- * dirtiness checker does not apply to this key. If non-null, this answer is assumed to be
- * definitive.
+ * If {@code applies(key)}, returns the result of checking whether this key's value is up to date.
*/
@Nullable
- public DirtyResult maybeCheck(SkyKey key, @Nullable SkyValue oldValue,
+ public DirtyResult check(SkyKey key, @Nullable SkyValue oldValue,
TimestampGranularityMonitor tsgm) {
- Optional<SkyValue> newValueMaybe = maybeCreateNewValue(key, tsgm);
- if (newValueMaybe == null) {
- return null;
- }
- if (!newValueMaybe.isPresent()) {
+ SkyValue newValue = createNewValue(key, tsgm);
+ if (newValue == null) {
return DirtyResult.dirty(oldValue);
}
- SkyValue newValue = Preconditions.checkNotNull(newValueMaybe.get(), key);
return newValue.equals(oldValue)
? DirtyResult.notDirty(oldValue)
: DirtyResult.dirtyWithNewValue(oldValue, newValue);