commit | 6e516e800c311ffe8f7db6dd1fd732601968d186 | [log] [tgz] |
---|---|---|
author | Sami Kyostila <skyostil@chromium.org> | Sun Oct 08 23:20:34 2023 +0000 |
committer | Sami Kyostila <skyostil@chromium.org> | Sun Oct 08 23:20:34 2023 +0000 |
tree | b9f9f01c4633822d26aa6fb92c41d7e8188edcca | |
parent | a0e3185a0d0c647442a9beb14f267074ac34563d [diff] |
protozero: Pack length fields for short nested messages Previously protozero uses 4 bytes for all nested message length fields despite the actual length of the message. This can be wasteful, especially for small nested messages. This patch adds logic to pack the length field for short messages (<= 127 bytes) into a single byte. This is done by shifting back the already-written message data into the preceeding length field. The assumption is that this data will still be in the L1 cache, so the cost of shifting it will be negligible. Latency benchmarking results (cloudtop): Before: go/paste/5009322705682432 After: go/paste/5758827482841088 (tl;dr: any changes seem to be within noise) For a size benchmark, I loaded https://theverge.com on a fresh Chrome profile while tracing all categories (just Chrome, no traced) for 10 seconds. The uncompressed trace sizes were: Before: 64302974 bytes After: 56297094 bytes (-12.5%) Bug: b/135511481 Change-Id: Ia2d4c81160af2bcdf7d2df342124408719d8f9fe
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://perfetto.dev/docs or the /docs/ directory for documentation.