Optimize protocol buffers native code size |
|||||||||||
Issue description
Protocol buffers take up >900kb of libchrome.so:
tools/binary_size/console.py out-gn/Release/lib.unstripped/libchrome.so.map.gz --query 'symbols.WhereObjectPathMatches("/protobuf/|.pb.o$")'
Ideas to reduce the overhead:
1. Add lite_runtime to these: https://cs.chromium.org/search/?q=lang:proto+-optimize_for+file:%5Esrc/+package:%5Echromium$+-f:third_party&type=cs
2. Consider trading off on runtime performance for binary size/symbol leaks by changing optimize_for to CODE_SIZE for https://cs.chromium.org/search/?q=lang:proto+optimize_for+file:%5Esrc/+package:%5Echromium$+-f:third_party&type=cs
3. Try out a change where you mark every proto field as [weak = true]. This will trade off on runtime performance for linker optimization to drop unused portions of your proto trees
4. Delete all unused fields from .proto files (so they will be skipped over at runtime)
5. Switch to https://github.com/nanopb/nanopb (reportedly 10x smaller code size)
,
Apr 10 2017
,
Apr 10 2017
,
May 9 2017
,
May 15 2017
+zea in case you have ideas here.
,
May 15 2017
+Sky who I think was investigating proto changes. LITE_RUNTIME, which Sync already uses, seems like it would be a good first step.
,
May 16 2017
Updated params from agrieve@:
Categorize:
tools/binary_size/supersize console chrome.size --query 'Print(canned_queries.CategorizeGenerated())'
Extract Protocol Buffer related stuff:
tools/binary_size/supersize console chrome.size --query 'Print(size_info.symbols.WhereObjectPathMatches(".*/protobuf/|\\.pb\\.o$|\\.pbzero\\.o$").Sorted(),verbose=1)'
,
Oct 3 2017
Not working on this actively.
,
Jan 17 2018
,
Jan 17 2018
,
Dec 13
,
Jan 3
|
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by agrieve@chromium.org
, Apr 10 2017