Repository navigation
Replace the arm-unstable arrayReduce('avg') query of the vectorize_aggregation_combinators performance test - #130757
Conversation
…-array variant
Query 4 (`arrayReduce('avg')` over 10M rows of 16-element arrays) takes one
extra branch miss per row in some arm builds, depending on where unrelated
code places `addBatchArray`, so it fails the perf check of unrelated PRs.
Disable it (keeping its number) and append the same query over 1024-element
arrays with the same 160M elements, so a per-row mode is bounded.
WIP: implements fix-plan r0 exactly; IMPL measured that the new query
allocates 512 MiB blocks (replan pending).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… rows `Log` reads `max_block_size` rows per block whatever the row width, so at the default 65505 a block of 1024-element `UInt64` arrays is 512 MiB. perf.py purges jemalloc before each run, so every run gave that memory back and re-faulted it, and about half of the query's time was kernel page-fault work instead of `arrayReduce`. `max_block_size = 1024` keeps the blocks at 1M elements (8 MiB), like query 4's 65505 x 16, and 312500 rows keep the query near 0.2 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (click to expand)Second-model review (Gate B) of
|
|
cc @Algunenano, could you review this? It disables query 4 of vectorize_aggregation_combinators (arrayReduce avg over 16-element arrays), which is 12-20% slower in some arm builds from one extra branch miss per row in byte-identical code at another address, and adds the same query over 1024-element arrays with max_block_size = 1024, so a per-row mode costs about 1%. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261111-104100 |
|
Workflow [PR], commit [20347e9] Summary: ✅
AI ReviewSummaryPR #130757 disables the ARM-sensitive, 16-element Missing context / blind spots
Tests
Final VerdictStatus: |
b5e3d10
Related: #107436
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
vectorize_aggregation_combinators #4(SELECT arrayReduce('avg', v) FROM array_data, 10M rows of 16-element arrays) is 12-20% slower in 23 of 1036 arm PR builds since 2026-11-07 and in 7 consecutive master builds (none is faster by more than 9%): 9Performance Comparison (arm_release, ...)reds on PRs that do not touch it, as asked in #107436 (comment).The slow builds execute the same instructions but take one extra branch miss per row (about 10M, 13-18 cycles each), all in
addBatchArrayofAggregateFunctionAvg<UInt64>, which is byte-identical in the fast and slow binaries and only placed elsewhere. A PR that is slow at one head is fast at another (1.19x, then 1.00x). No merged PR introduced it: the mode was +14% before #127206, which made the query 27% faster, so the same ~55 ms now crosses the threshold.The query gets
disabled="1"(number and text kept), and query 5 runs it over 312500 rows of 1024-element arrays, so a per-row mode costs at most about 2 ms (1%).max_block_size = 1024keeps itsLogblocks at 1M elements like query 4; at the default the blocks are 512 MiB, and perf.py purges jemalloc before each run, so half the time was page faults. Trade-off: the per-row state handling ofarrayReduceis much less visible; the batch path the test was added for is 40% of the profile instead of 19%.Validation (x86, perf-reference binary of the base):
perf.py --print-querieskeeps 0-4 unchanged; three A/Aperf.pyruns with the CI flags skip query 4 and time query 5 at 0.203-0.205 s, A/A within 1.3%; per run 7 ms system time, 2.6k page faults, 22 MiB. The arm jobs of this PR measure query 5 on arm.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/130757]
Version info
26.11.1.2032-master(included in26.11and later)