diff options
author | 2016-08-16 20:41:22 +0000 | |
---|---|---|
committer | 2016-08-17 11:26:33 +0000 | |
commit | d1910c35673123654b251af478320cf05a96d9e0 (patch) | |
tree | c5d5aaf6fc96eba2ff80a14130e8f4022b518bfc /src/tools/android/java/com/google/devtools/build/android/xml/PluralXmlResourceValue.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/xml/PluralXmlResourceValue.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/xml/PluralXmlResourceValue.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/xml/PluralXmlResourceValue.java b/src/tools/android/java/com/google/devtools/build/android/xml/PluralXmlResourceValue.java index a8e92e4b19..7649117f05 100644 --- a/src/tools/android/java/com/google/devtools/build/android/xml/PluralXmlResourceValue.java +++ b/src/tools/android/java/com/google/devtools/build/android/xml/PluralXmlResourceValue.java @@ -133,10 +133,10 @@ public class PluralXmlResourceValue implements XmlResourceValue { } @Override - public int serializeTo(Path source, Namespaces namespaces, OutputStream output) + public int serializeTo(int sourceId, Namespaces namespaces, OutputStream output) throws IOException { SerializeFormat.DataValue.Builder builder = - XmlResourceValues.newSerializableDataValueBuilder(source); + XmlResourceValues.newSerializableDataValueBuilder(sourceId); SerializeFormat.DataValue value = builder .setXmlValue( |