aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java
index 034c9647a0..9c5c164384 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java
@@ -377,12 +377,11 @@ final class ConfiguredTargetFunction implements SkyFunction {
private static final class AttributeAndLabel {
final Attribute attribute;
final Label label;
- final int hashCode;
+ Integer hashCode;
AttributeAndLabel(Attribute attribute, Label label) {
this.attribute = attribute;
this.label = label;
- this.hashCode = Objects.hash(this.attribute, this.label);
}
@Override
@@ -396,6 +395,11 @@ final class ConfiguredTargetFunction implements SkyFunction {
@Override
public int hashCode() {
+ if (hashCode == null) {
+ // Not every <Attribute, Label> pair gets hashed. So only evaluate for the instances that
+ // need it. This can significantly reduce the number of evaluations.
+ hashCode = Objects.hash(this.attribute, this.label);
+ }
return hashCode;
}
}