Repository navigation
Conversation
Similar to `clickhouse_log` but accepts a log level as the first `i32` argument, mapping directly to `Poco::Message::Priority` values: 1=FATAL, 2=CRITICAL, 3=ERROR, 4=WARNING, 5=NOTICE, 6=INFORMATION, 7=DEBUG, 8=TRACE. Values outside this range are clamped to TRACE. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> commit-id:e07955d2
This was referenced Mar 13, 2026
bacek
pushed a commit
that referenced
this pull request
Oct 3, 2026
…nce per block `mortonEncode` with two arguments ran one row loop for every argument type and mask: per row and argument it tested the mask and `is_const`, reloaded the ratio, switched on the column width and, with a mask, called the out-of-line `expand` (36 call sites in the arm `executeImpl`). On arm the speed of the branch-dense paths depends on the binary's layout, so `space_filling_curve` #1 (constant mask) and #4 (`UInt32` arguments) have per-build speed modes and flag unrelated PRs in Performance Comparison (ClickHouse#122482), while #2 (two `UInt64` columns) is stable. Now each argument is resolved once per call into a contiguous `UInt64` array with the range expansion applied: a `UInt64` column that needs no expansion is read in place, other widths are widened with one type dispatch, and a constant ratio is applied in one loop per ratio value (`expand` is `ALWAYS_INLINE` and called with a template-constant ratio, so its switch folds). A per-row mask keeps the per-row `expand`. `nd == 1` writes the result column directly. The encode loops only encode. x86, one core, median fix/base of 5 interleaved rounds over the queries of `space_filling_curve.xml`: #1 0.57 (BMI2) / 0.55 (lookup-table path, built with `-mno-bmi2`), #2/#3/#6 0.45-0.64, #4 0.86-0.88, untouched functions 0.99-1.03. Results are unchanged: 545 checksums over every width, mask and ratio are byte-identical before and after on both code paths, and the new test fails on both paths under two mutations of the change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bacek
pushed a commit
that referenced
this pull request
Oct 17, 2026
The scaled loop of `convertToDecimalBatch` checked every row twice: the multiplication against `DecimalScaleBounds` of the wide intermediate type, then the product against the destination range. A cast from `Int128` paid four `Int256` comparisons and an `Int256` multiplication per row, which made `decimal_casts` #3-#6 1.15-1.74x slower than master (Performance Comparison, arm_release). The source values whose product with `m` fits the destination are `[ceil(min / m), floor(max / m)]`. Compute that range once per block, clamped to the source type, compare each row in the source type and multiply in the destination type. A `UInt256` above the `Int256` maximum is above that range, so it needs no separate check in this loop. The results are the same as before for every integer source type, decimal width and scale (boundary values around both limits checked against an independent oracle). On an x86-64-v3 RelWithDebInfo build the casts take 0.39-1.03x of master's time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bacek
pushed a commit
that referenced
this pull request
Oct 23, 2026
…h set When `hasAny(Array(String), <constant Array(String)>)` does not build the needle hash set for a block (fewer than 4 needles, a needle longer than 256 bytes, or a block too small for the set to pay off), it used to fall back to the generic GatherUtils path. That path makes two virtual calls per row from the per-row loop of `arrayAllAny` (`ColumnString::structureEquals` from `sliceHas`, and `ColumnString::compareAt` per element/needle pair). The speed of that loop turned out to depend on code placement. Three PR builds of 2026-10-18 (ClickHouse#123788, ClickHouse#100394, ClickHouse#63383; their diffs share no file and none touches Functions/ or Columns/) ran `has_any_constant_string_needles` queries #5 and #6 1.2-2.1x slower than the master reference in all three process lifetimes of their perf job, on three different runners, with md5-identical machine code for the four functions involved. Across 24 inspected CI builds, a build is slow exactly when a 64-byte line of `compareAt` or `structureEquals` coincides with a line of the `arrayAllAny` loop modulo 8 KiB (3/3 slow, 0/21 fast). Reproduced locally with the CI binaries: query #6 takes 1.04-1.35 s on the three slow builds vs 0.62 s on three fast ones, at equal instruction counts. Now the declined block compares each element with each needle directly (`getDataAt` + `memequalSmallAllowOverflow15`, the comparison `ColumnString::compareAt` makes), in the generic path's order (needles outer, elements inner, first match wins). The loop has no call left, and it is faster for every declined shape: on a release build, perf test queries #4-#7 take 0.73-0.91x of the base time and #0-#3 (set path) are unchanged. Adds perf query #7 for the fewer-than-4-needles branch, the only declined branch the test did not cover. Non-String columns still use the generic path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bacek
pushed a commit
that referenced
this pull request
Nov 16, 2026
…oop over batches of rows The previous commit replaced the per-row `isCancelled` load with a mask test on the row index. On AArch64 clang-23 keeps that test and its branch in the row loop (`tst x23, #0x3ff; b.ne` per row, the only difference from the previous build of this branch), and `limit_by` #0/#3/#5/#6 and `optimize_limit_by_keys` #0/#1 are 1.18-1.22x slower than master there, while the two previous runs had them at 1.00x. Make the batching explicit instead: an outer loop over batches of 1024 rows checks for cancellation, and the inner row loop contains the hash lookup only. Measured with the CI binaries on a Graviton 4 host against the clang-22 master build: 0.99-1.05x (PR build: 1.18-1.22x). CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117346&sha=d847a368b13c19355fbfac4bbcec67663d20ec9f&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%201%2F6%29 PR: ClickHouse#117346 Co-Authored-By: Claude Fable 5.1 <[email protected]>
bacek
pushed a commit
that referenced
this pull request
Nov 16, 2026
…dimensions on AArch64 `morton_decode` #6 (`mortonDecode(8, number)`) is 1.24x slower with clang-23 on AArch64. `MortonNDLutDecoder<8, 8, 8>::DecodeInternal` is out of line in both builds, but clang-23 compiles it to 218 instructions instead of 173: an XRay sled (the body crossed the 200-instruction threshold), callee-saved SIMD spills, and a wider SLP schedule with more constant loads (llvm-mca: 40 against 30 cycles per call). Apply `always_inline` to the morton-nd headers in `mortonDecode.cpp` and `mortonEncode.cpp` through `#pragma clang attribute`: that alone brings 8 dimensions from 1.24x to 1.15x and fixes 4 dimensions (`morton_decode` #2, 1.12x in the PR build, below the CI threshold) to 0.96x. For 8 dimensions, switch to `MortonNDCompressDecoder`, which under clang-23 measures equal to the clang-22 table decoder (0.99x), and add it to the compile-time equivalence check. Measured with the CI binaries on a Graviton 4 host against the clang-22 master build. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117346&sha=d847a368b13c19355fbfac4bbcec67663d20ec9f&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%204%2F6%29 PR: ClickHouse#117346 Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.
Similar to
clickhouse_logbut accepts a log level as the firsti32argument, mapping directly to
Poco::Message::Priorityvalues:1=FATAL, 2=CRITICAL, 3=ERROR, 4=WARNING, 5=NOTICE, 6=INFORMATION,
7=DEBUG, 8=TRACE. Values outside this range are clamped to TRACE.
Co-Authored-By: Claude Sonnet 4.6 [email protected]
Stack:
clickhouse_log2WebAssembly host function with log level argument #6 ⬅"env"module imports only #4