perfetto: add Zstd as a trace compression codec#6459
Open
sashwinbalaji wants to merge 3 commits into
Open
Conversation
🎨 Perfetto UI Builds
|
d056538 to
c4bdcce
Compare
c4bdcce to
e9328ad
Compare
LalitMaganti
reviewed
Jul 2, 2026
primiano
approved these changes
Jul 2, 2026
primiano
left a comment
Member
There was a problem hiding this comment.
Great work really!
LGTM with a few minor comments
e9328ad to
77ee6d1
Compare
The tracing service could already compress its output with deflate. This adds Zstd, which produces smaller traces at a similar speed. - Traces opt in with the new TraceConfig.compression field: set compression.zstd for Zstd or compression.deflate for deflate. If both are set, the higher field number wins (so zstd over deflate). - Zstd's level is configurable via compression.zstd.level (1 fastest to 22 smallest; 0 or unset uses zstd's default). - The old compression_type field is now deprecated but still honored, so services that predate `compression` keep compressing. - The service picks the codec from the config and runs it directly. A codec's library is only linked when its build flag (PERFETTO_ZLIB / PERFETTO_ZSTD) is on, so libz/libzstd stay out of builds that don't use compression, such as the SDK. - Each codec is configured by its own proto message, so the service never needs to know a codec's specific options. - Adding a codec later (e.g. lz4) is a new compressor file, one branch in the service, and a proto sub-message - nothing else changes.
77ee6d1 to
380a9be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tracing service could already compress its output with deflate. This
adds Zstd, which produces smaller traces at a similar speed.
compression.zstd for Zstd or compression.deflate for deflate. If both
are set, the higher field number wins (so zstd over deflate).
smallest; 0 or unset uses zstd's default).
services that predate
compressionkeep compressing.codec's library is only linked when its build flag (PERFETTO_ZLIB /
PERFETTO_ZSTD) is on, so libz/libzstd stay out of builds that don't use
compression, such as the SDK.
needs to know a codec's specific options.
the service, and a proto sub-message - nothing else changes.