Skip to content

Update zstd to upstream dev with pending performance PRs - #127206

Draft
Algunenano wants to merge 4 commits into
ClickHouse:masterfrom
Algunenano:zstd-dev-20261021
Draft

Algunenano wants to merge 4 commits into
ClickHouse:masterfrom
Algunenano:zstd-dev-20261021

Conversation

@Algunenano

@Algunenano Algunenano commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Updates contrib/zstd to a rebase of the ClickHouse/zstd fork onto upstream dev (49cf5179, 2026-10-05; the old fork was 199 non-merge commits behind), plus pending upstream PRs and one new patch of ours. Fork branch: ClickHouse/dev-20261021 (8388bfae). The overlap-copy patches of the old fork are kept; its unwind-info patches are upstream already.

Changes on top of upstream dev:

Compressed output is byte-identical to the current fork at levels 1, 3, 6, 9 and 16, and the checksum of all columns of ClickBench hits is the same after decompression.

ClickBench hits (100M rows in one ZSTD(3) part, no columns cache, median of 20 hot runs, non-LTO local build) on AMD EPYC 9R14 (Zen 4), speedup vs current master:

Query 16 threads on 8 cores 64 threads on 32 cores
SELECT count() FROM hits WHERE NOT ignore(SearchPhrase) 1.22x 1.19x
same with URL 1.14x 1.12x
same with Title 1.17x 1.13x
same with ClientIP 1.21x 1.14x
same with RegionID 1.14x 1.13x
same with UserID 1.08x 1.03x
SELECT sum(cityHash64(*)) FROM hits 1.06x 1.06x
SELECT COUNT(DISTINCT SearchPhrase) FROM hits 1.12x 1.11x

zstd CLI on the same data, single core, ZSTD(3), ClickHouse block sizes, vs current master: compression 1.018x, decompression 1.175x (geomean over 7 numeric columns and the separate characters and sizes streams of 4 String columns). The short-offset copy alone, vs the same set without it: ClientIP 1.15x, UserID 1.12x, RegionID 1.085x, ResolutionWidth 1.065x, and the characters streams of long strings 1-2% slower; in ClickHouse it is 1.12x on the ClientIP scan, 1.08x on UserID, 1.06x on RegionID, 0.98x on URL and Title, 1.01x on sum(cityHash64(*)) and 1.02x on COUNT(DISTINCT SearchPhrase) (16 threads). On Graviton4 it is +5.6% CLI decompression geomean, ClientIP +45%, UserID +14%, and 1.20x on the ClientIP scan in ClickHouse.

Earlier measurements of the same set without the short-offset copy, vs current master:

Evaluated and not included:

Related: #124405

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Update zstd to the latest upstream development version with pending performance improvements. Decompression of ZSTD(3) data is up to 20% faster on x86.

Algunenano and others added 2 commits October 21, 2026 14:59
Rebase of the `ClickHouse/zstd` fork onto upstream `dev` (`49cf5179`), keeping the vectorized overlap-copy patches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
meta/zstd#4751, ClickHouse#4764, ClickHouse#4841, ClickHouse#4732 and ClickHouse#4811 on top of the rebased fork.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Algunenano Algunenano self-assigned this Oct 21, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e37a4a6]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_asan_ubsan, targeted) FAIL
05407_distributed_plan_exchange_compression_default FAIL cidb
05407_distributed_plan_exchange_compression_default FAIL cidb
05407_distributed_plan_exchange_compression_default FAIL cidb
05407_distributed_plan_exchange_compression_default FAIL cidb
Stateless tests (amd_tsan, s3 storage, targeted) FAIL
05407_distributed_plan_exchange_compression_default FAIL cidb
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 2/2) FAIL
05407_distributed_plan_exchange_compression_default FAIL cidb
Performance Comparison (amd_release, master_head, 4/6) FAIL Performance dashboard
hashing_serialized_values #0 FAIL dashboard

AI Review

Summary

PR #127206, reviewed at e37a4a6a7df6f7a9711ab2d20ad7cedd1b864883, updates zstd with compression and decompression optimizations. No actionable findings remain; both earlier findings are fixed. AArch64 ASan validation passed 115,200 focused short-offset round trips, the basic tests, 309 randomized tests, 1,648 randomized streaming tests, and the legacy suite including both v0.5 wrapping regressions.

Missing context / blind spots
  • ⚠️ Full CI for the reviewed head is still running. Local runtime checks used AArch64/GCC with ASan; the x86 intrinsic and assembly paths were inspected but not executed locally. Completion of the head's x86 and sanitizer CI would close this platform-validation gap.
Final Verdict

Status: ✅ Approve. No required code changes.

@clickhouse-gh clickhouse-gh Bot added pr-performance Pull request with some performance improvements submodule changed At least one submodule changed in this PR. labels Oct 21, 2026
Comment thread contrib/zstd Resolved
Comment thread contrib/zstd Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. label Oct 21, 2026
Drop the row matchfinder change, which has a big-endian bug and no gain at `ZSTD(3)`, and add the fix for the legacy v0.5 streaming regression.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clickhouse-gh

clickhouse-gh Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit e37a4a6a7df6f7a9711ab2d20ad7cedd1b864883 was not compared: the CI logs cluster did not answer (exception 241, code 500: { "meta": [ { "name": "file", "type": "LowCardinality(String)" …).

See the job log for details.

`contrib/zstd` moves to `8388bfaec` on `ClickHouse/dev-20261021` of
https://github.com/ClickHouse/zstd: the same set as before (`984dab56b`)
plus a branchless copy of matches with offsets below 16 (NEON `tbl`,
SSSE3 `pshufb`, AVX2 `vpshufb`). It replaces the `offset < 8` branch of
`ZSTD_overlapCopy8`, which mispredicts often on numeric columns.

Graviton4, ClickBench `hits` columns at level 3 with ClickHouse block
sizes: decompression +5.6% geomean over 13 columns (`ClientIP` +45%,
`UserID` +14%), no column slower. In ClickHouse with 16 threads, the
`ClientIP` scan is 1.20x and the `UserID` scan 1.07x faster.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

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

Labels

comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. performance pr-performance Pull request with some performance improvements submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant