Repository navigation
Use data without long LZ4 matches in the adaptive_codec_merge performance test - #124741
Conversation
…ance test `adaptive_codec_merge` was filled with `cityHash64(number % 1024)`, an exact 8 KiB period. Every 64 KiB compressed block is then 8 KiB of literals plus one ~56 KiB match, so query 0 (`OPTIMIZE TABLE ... FINAL`) spends its LZ4 time in the match-length loop `LZ4_count`, which adaptive selection runs twice per block (raw block and T64 chain output). That loop's machine code is byte-identical in the official amd_release builds, but some code layouts make it slow: on build 47a31cd vs its parent cbbf13b, instructions 4.81e10 vs 4.86e10, `baclears.any` 2.62e8 vs 6.42e6, `int_misc.unknown_branch_cycles` 3.14e9 vs 1.12e8, `lsd.uops` 1.62e10 vs 2.22e10, backend counters equal, `LZ4_compress_fast_extState` 1857 vs 892 samples with every other frame equal. A plain LZ4 merge of the same data (`enable_adaptive_codec_selection = 0`) shows the same slow draw, so it is not adaptive selection code. Such builds (official master 47a31cd, 1200a74, 12e23c6 and several PR builds since 2026-10-06) run query 0 ~20% slower on either side of a comparison, and the dashboard gate reports it as a confirmed regression on unrelated PRs. The new data repeats each of 1024 random 64-bit hashes 8 times: many short matches instead of one long one. LZ4 still wins every block (3663/3663), and adaptive selection is ~71% of the merge time instead of ~37% (plain LZ4 0.164 s vs 0.567 s). On 9 official master builds, 3 of them slow on the old data, 3 rounds of 5 merges: medians 0.562-0.584 s, every build within 3% of the median and within 2% of its own parent. 30M rows keeps query 0 near its old run time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (3 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261008-204300 |
|
Workflow [PR], commit [5efd1ca] Summary: ✅
AI ReviewSummaryThis PR changes Final Verdict
|
Related: #123798
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Performance Comparison (amd_release, master_head, 5/6)failed on #123798:adaptive_codec_merge #00.607 -> 0.745 s (+23%). Since 2026-10-06 some amd builds, including official master builds 47a31cd, 1200a74 and 12e23c6, run this query ~20% slower on whichever side of the comparison they are; no other query moves consistently.The table's data has an exact 8 KiB period, so every 64 KiB block compresses to 8 KiB of literals plus one ~56 KiB match and the merge is dominated by LZ4's match-length loop (
LZ4_count). Its machine code is identical in all builds, but in some code layouts the CPU front end runs it at about half speed (same instruction count, 2x the cycles inLZ4_compress_fast_extState). A plain LZ4 merge of the same data (enable_adaptive_codec_selection = 0) shows the same slow draw.The new data repeats each of 1024 random hashes 8 times. LZ4 still wins every block, and adaptive selection is now ~71% of the merge instead of ~37%. On 9 official master builds (3 slow on the old data), 3 rounds of 5 merges each: 0.56-0.58 s, every build within 3% of the median. Queries 1 and 2 are unchanged.
Workflow [PR]
Sync PR [sync-upstream/pr/124741]
Version info
26.10.1.1927-master(included in26.10and later)