Skip to content

perf(cpp): skip LZ4 frame checksums (XXH32) for a measurable throughp… - #1742

Draft
facontidavide wants to merge 1 commit into
foxglove:mainfrom
facontidavide:perf/lz4-skip-checksums
Draft

perf(cpp): skip LZ4 frame checksums (XXH32) for a measurable throughp…#1742
facontidavide wants to merge 1 commit into
foxglove:mainfrom
facontidavide:perf/lz4-skip-checksums

Conversation

@facontidavide

Copy link
Copy Markdown

…ut gain

Profiling a point-cloud-heavy MCAP showed LZ4_XXH32_update consuming more CPU than the decompression itself (~12% vs ~9% of total application CPU on a GUI thread). Skipping the frame-level block and content checksum via LZ4F_decompressOptions_t.skipChecksums eliminates that cost — roughly a 41% reduction in total LZ4 decode CPU.

Structural corruption is still caught by the size/consumption checks already present in decompressAll(): wrong output size (dstSize != uncompressedSize), partial consumption (srcSize != compressedSize), and LZ4F_isError on the return code. The XXH32 integrity hash is therefore redundant for callers that trust the source (local files, verified network transports).

Changelog

Docs

Description

BeforeAfter

…ut gain

Profiling a point-cloud-heavy MCAP showed LZ4_XXH32_update consuming
more CPU than the decompression itself (~12% vs ~9% of total
application CPU on a GUI thread). Skipping the frame-level block and
content checksum via LZ4F_decompressOptions_t.skipChecksums eliminates
that cost — roughly a 41% reduction in total LZ4 decode CPU.

Structural corruption is still caught by the size/consumption checks
already present in decompressAll(): wrong output size (dstSize !=
uncompressedSize), partial consumption (srcSize != compressedSize), and
LZ4F_isError on the return code. The XXH32 integrity hash is therefore
redundant for callers that trust the source (local files, verified
network transports).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@facontidavide
facontidavide marked this pull request as draft June 22, 2026 11:47

@james-rms james-rms left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense to control via an option on the MCAP library, but might be unexpected as a default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants