Custom binary XML wire protocol.
We've identified that XML writing and reading uses roughly 1.5% of all system_server CPU, and can generate many temporary objects. Building on the recent TypedXmlSerializer/PullParser interfaces, this change introduces new BinaryXmlSerializer/PullParser implementations that store data using a custom binary wire protocol. Benchmarking of a typical packages.xml has shown this new binary approach can write 4.3x faster and read 8.5x faster, while using 2.4x less disk space: timeWrite_Fast_mean: 27946635 timeWrite_Binary_mean: 6519341 timeRead_Fast_mean: 59562531 timeRead_Binary_mean: 7020185 A major factor in choosing to invest in this new wire protocol is that it enables the long-tail of over 100 unique XML schemas used across the OS internals to be transparently upgraded to gain these benefits with only minimal changes, reducing the risks associated with rewriting those schemas. Finally, since the wire protocol is essentially a serialized event stream, it's trivial to transparently convert this new protocol into human-readable XML and vice-versa. The tests in this change demonstrate this translation working correctly, and future changes will introduce new shell tools to aid development work. Bug: 171832118 Test: atest FrameworksCoreTests:android.util.XmlTest Test: atest FrameworksCoreTests:android.util.BinaryXmlTest Test: atest CorePerfTests:android.util.XmlPerfTest Change-Id: Ib9390701f09562dca952b3786622675b9c68a462
Loading
Please register or sign in to comment