From 9395d11c2fd14cdc4293ef11f3b30516267a3eb1 Mon Sep 17 00:00:00 2001 From: tomlu Date: Wed, 15 Aug 2018 10:06:40 -0700 Subject: Have DigestMap support multiple hash functions. RELNOTES: None PiperOrigin-RevId: 208837641 --- .../build/lib/collect/nestedset/NestedSetFingerprintCache.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetFingerprintCache.java') diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetFingerprintCache.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetFingerprintCache.java index 8eb4131793..e0481b98f6 100644 --- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetFingerprintCache.java +++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetFingerprintCache.java @@ -20,6 +20,7 @@ import com.google.common.collect.Multiset; import com.google.devtools.build.lib.actions.CommandLineItem; import com.google.devtools.build.lib.actions.CommandLineItem.MapFn; import com.google.devtools.build.lib.util.Fingerprint; +import com.google.devtools.build.lib.vfs.DigestHashFunction; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -27,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap; /** Computes fingerprints for nested sets, reusing sub-computations from children. */ public class NestedSetFingerprintCache { - private static final int DIGEST_SIZE = 16; private static final int EMPTY_SET_DIGEST = 104_395_303; /** Memoize the subresults. We have to have one cache per type of command item map function. */ @@ -121,6 +121,8 @@ public class NestedSetFingerprintCache { mapFnClass.getName())); } } - return new DigestMap(DIGEST_SIZE, 1024); + // TODO(b/112460990): Use the value from DigestHashFunction.getDefault(), but check for + // contention. + return new DigestMap(DigestHashFunction.MD5, 1024); } } -- cgit v1.2.3