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/DataValue.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/DataValue.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/DataValue.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/DataValue.java b/src/tools/android/java/com/google/devtools/build/android/DataValue.java index f30916f1f6..e8427a4a34 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataValue.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataValue.java @@ -32,5 +32,6 @@ public interface DataValue { /** * Serializes to a supplied stream and returns the number of bytes written. */ - int serializeTo(DataKey key, OutputStream output) throws IOException; + int serializeTo( + DataKey key, DataSourceTable sourceTable, OutputStream output) throws IOException; } |