diff options
author | Googler <noreply@google.com> | 2016-08-16 20:41:22 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2016-08-17 11:26:33 +0000 |
commit | d1910c35673123654b251af478320cf05a96d9e0 (patch) | |
tree | c5d5aaf6fc96eba2ff80a14130e8f4022b518bfc /src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java | |
parent | 2f36f313b9d10e89611207422a4271f733fe49df (diff) |
Share source paths for more compact res proto serialization
Source abs paths can be pretty long. If a value
file like colors.xml has N resources then we
serialize the path N times. Instead, make a
table and just serialize the index. Can reduce
resource proto sizes from X to 0.65*X. in some
experiments. CPU instructions executed is slightly
lower, but critical path impact is pretty minimal
since parsing happens in parallel anyway.
This doesn't help with drawables (path only shows
up once) but doesn't really hurt (an extra index
number). I tried sharing the root (a table of the
res dirs). That can be another 10%, and helps with
the drawable case. However, a naive enumeration
of roots (src.getParent().getParent()) added *much*
more overhead to the writing stage, so I didn't
go on with that.
--
MOS_MIGRATED_REVID=130440810
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java b/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java index 7bda269b58..2cc49a8c34 100644 --- a/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java +++ b/src/tools/android/java/com/google/devtools/build/android/XmlResourceValues.java @@ -419,9 +419,9 @@ public class XmlResourceValues { return false; } - public static SerializeFormat.DataValue.Builder newSerializableDataValueBuilder(Path source) { + public static SerializeFormat.DataValue.Builder newSerializableDataValueBuilder(int sourceId) { SerializeFormat.DataValue.Builder builder = SerializeFormat.DataValue.newBuilder(); - return builder.setSource(builder.getSourceBuilder().setFilename(source.toString())); + return builder.setSourceId(sourceId); } public static int serializeProtoDataValue( |