diff options
author | 2016-12-15 17:25:08 +0000 | |
---|---|---|
committer | 2016-12-15 20:38:55 +0000 | |
commit | e3db95e855ac11f161d24d472efd488dc4085dfe (patch) | |
tree | 421e1c652eabd57b6ab0925ba9fa4e7876cfc742 /src/main/java/com/google/devtools/build/lib/actions/cache | |
parent | 49757602c4ca9e48081f98850007b2ef17427b46 (diff) |
Streamline Fingerprint implementation
Thread all updates through a CodedOutputStream. This has the benefit of
potentially hashing less data, as many int values can be represented more
compactly, and reducing the churn of hashing strings (generally), since
CodedOutputStream is already heavily optimized for this. While the buffer
size is a little generous, it winds up paying off.
--
PiperOrigin-RevId: 142151062
MOS_MIGRATED_REVID=142151062
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/actions/cache')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java b/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java index 3dcfe54937..508ee8920a 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java +++ b/src/main/java/com/google/devtools/build/lib/actions/cache/DigestUtils.java @@ -163,15 +163,15 @@ public class DigestUtils { byte[] result = new byte[Md5Digest.MD5_SIZE]; Fingerprint fp = new Fingerprint(); for (Map.Entry<String, String> entry : env.entrySet()) { - fp.addStringLatin1(entry.getKey()); - fp.addStringLatin1(entry.getValue()); + fp.addString(entry.getKey()); + fp.addString(entry.getValue()); xorWith(result, fp.digestAndReset()); } return new Md5Digest(result); } private static byte[] getDigest(Fingerprint fp, String execPath, Metadata md) { - fp.addStringLatin1(execPath); + fp.addString(execPath); if (md == null) { // Move along, nothing to see here. |