aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/collect
diff options
context:
space:
mode:
authorGravatar cpeyser <cpeyser@google.com>2018-05-22 11:43:48 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-22 11:45:12 -0700
commitd92688eec14040d9a381291bbb881a4b26a4d55d (patch)
tree13d75c66ff6e319201a64995b843e8cf38c4f097 /src/main/java/com/google/devtools/build/lib/collect
parent566ef5aa79b15efbb50694422e992de5df7da596 (diff)
Serialize NestedSetStore$NestedSetSize directly as an ordinal instead of
through SerializationContext, to save a byte. PiperOrigin-RevId: 197597779
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/collect')
-rw-r--r--src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetCodecWithStore.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetCodecWithStore.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetCodecWithStore.java
index 030b0a3332..a673920cd4 100644
--- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetCodecWithStore.java
+++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/NestedSetCodecWithStore.java
@@ -64,13 +64,13 @@ public class NestedSetCodecWithStore<T> implements ObjectCodec<NestedSet<T>> {
if (obj.isEmpty()) {
// If the NestedSet is empty, it needs to be assigned to the EMPTY_CHILDREN constant on
// deserialization.
- context.serialize(NestedSetSize.EMPTY, codedOut);
+ codedOut.writeEnumNoTag(NestedSetSize.EMPTY.ordinal());
} else if (obj.isSingleton()) {
// If the NestedSet is a singleton, we serialize directly as an optimization.
- context.serialize(NestedSetSize.SINGLETON, codedOut);
+ codedOut.writeEnumNoTag(NestedSetSize.SINGLETON.ordinal());
context.serialize(obj.rawChildren(), codedOut);
} else {
- context.serialize(NestedSetSize.GROUP, codedOut);
+ codedOut.writeEnumNoTag(NestedSetSize.GROUP.ordinal());
FingerprintComputationResult fingerprintComputationResult =
nestedSetStore.computeFingerprintAndStore((Object[]) obj.rawChildren(), context);
context.addFutureToBlockWritingOn(fingerprintComputationResult.writeStatus());
@@ -87,7 +87,7 @@ public class NestedSetCodecWithStore<T> implements ObjectCodec<NestedSet<T>> {
}
Order order = context.deserialize(codedIn);
- NestedSetSize nestedSetSize = context.deserialize(codedIn);
+ NestedSetSize nestedSetSize = NestedSetSize.values()[codedIn.readEnum()];
switch (nestedSetSize) {
case EMPTY:
return NestedSetBuilder.emptySet(order);