Repository navigation
Per-call cache of non-constant replaceRegexpAll/replaceRegexpOne patterns - #122850
NIKTONIKTO717 wants to merge 1 commit into
Conversation
|
Workflow [PR], commit [1cc5e46] Summary: ❌
AI ReviewSummaryThis PR adds a per-call cache for compiled non-constant Final Verdict✅ No findings. LLVM Coverage ReportMeasured on commit 1cc5e46.
Changed lines: Changed C/C++ lines covered: 46/46 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes3 object files changed (+46.52 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units8 translation units recompiled, 14 s compile time in total, 8 of them have a recent master baseline. |
|
📊 Cloud Performance Report ✅ AI verdict: This PR adds a per-block cache of compiled regular expressions to replaceRegexpOne/replaceRegexpAll, but only when the pattern argument is a non-constant column. The constant-pattern path is unchanged. The only flagged query, clickbench Q23 (-40.0%), does not call these functions with a per-row pattern, so it is downgraded to not_sure. Master's timings for this query are very noisy (its recent history is flaky), and the PR's 51 ms median falls inside master's current range of 48–87 ms. No tpch_adapted_1_official queries were flagged. The workload this PR targets is measured by the new replaceRegexp_nonconst_needle performance test, not by these benchmarks. clickbenchFlagged queries (1 of 43)
Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on. tpch_adapted_1_official🟢 No significant changes Debug info
|
|
We are optimizing a corner case. Consider abandoning this PR. |
| return regexp_options; | ||
| } | ||
|
|
||
| class LocalRegexpCache |
There was a problem hiding this comment.
There is virtually the same class in src/Functions/Regexps.h, let's unify or reuse but not copypaste code without good reason.
replaceRegexpAllandreplaceRegexpOnewith a non-constant pattern cache the compiled patterns for the duration of a call. 1 thread, 1M rows, 4 distinct patterns: 9.3 s → 1.1 s (8x faster).Up to 256 buckets by hash plus a scratch slot, with byte-exact hits. A new pattern enters its bucket only when it comes back, so all-distinct patterns are unchanged (±1.3%).
Performance test: new
replaceRegexp_nonconst_needle.xml.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Much faster
replaceRegexpAllandreplaceRegexpOnewhen the pattern is a non-constant column with repeating values.Workflow [PR]
Sync PR [sync-upstream/pr/122850]