Files
ClickHouse/tests/performance/replace_string_fast_path.xml
Alexey MilovidovandClaude Opus 5.5 c02ed54b14 Make the replace_string_fast_path performance test less noisy
Each query copied only 5 million rows and finished in ~20 ms, so the
performance comparison measured memory-bandwidth jitter: query #4
(`FixedString` verbatim copy) was flagged as a confirmed slowdown on
`master` itself (2026-09-17) and on unrelated pull requests (#119839,
#110613), and queries #2..#4 moved 11-17% together in one run.
Process 20 million rows, so each query takes ~100 ms.

Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=110613&sha=dbef7b1548eb9998ee9556d003008cd13d3bffee&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%204%2F6%29
PR: https://github.com/ClickHouse/ClickHouse/pull/110613

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 20:49:12 +00:00

22 lines
2.4 KiB
XML

<!-- Tests the fast paths in ReplaceStringImpl::vectorConstantConstant / vectorFixedConstantConstant (issue #106598):
1. one-byte needle + one-byte replacement in "replace all" mode: the string layout is unchanged, so the
column is copied once and matching bytes are flipped in place, skipping the Volnitsky search;
2. needle == replacement: a no-op for any needle length and both modes, so the column is copied verbatim. -->
<!-- _materialize_ because the shortcuts only apply to non-const haystack + const needle + const replacement -->
<test>
<!-- one-byte needle + one-byte replacement, replace all: byte-flip fast path -->
<query>WITH 'Many years later as he faced the firing squad, Colonel Aureliano Buendia was to remember that distant afternoon when his father took him to discover ice.' AS s SELECT replaceAll(materialize(s), ' ', '_') AS w FROM numbers_mt(20000000) FORMAT Null</query>
<!-- needle == replacement, one byte, replace all: verbatim-copy no-op -->
<query>WITH 'Many years later as he faced the firing squad, Colonel Aureliano Buendia was to remember that distant afternoon when his father took him to discover ice.' AS s SELECT replaceAll(materialize(s), ' ', ' ') AS w FROM numbers_mt(20000000) FORMAT Null</query>
<!-- needle == replacement, multi-byte, replace all: verbatim-copy no-op -->
<query>WITH 'Many years later as he faced the firing squad, Colonel Aureliano Buendia was to remember that distant afternoon when his father took him to discover ice.' AS s SELECT replaceAll(materialize(s), 'distant', 'distant') AS w FROM numbers_mt(20000000) FORMAT Null</query>
<!-- needle == replacement, multi-byte, replace one: verbatim-copy no-op -->
<query>WITH 'Many years later as he faced the firing squad, Colonel Aureliano Buendia was to remember that distant afternoon when his father took him to discover ice.' AS s SELECT replaceOne(materialize(s), 'distant', 'distant') AS w FROM numbers_mt(20000000) FORMAT Null</query>
<!-- needle == replacement, FixedString: vectorFixedConstantConstant verbatim-copy no-op -->
<query>WITH 'Many years later as he faced the firing squad, Colonel Aureliano Buendia was to remember that distant afternoon when his father took him to discover ice.' AS s SELECT replaceAll(materialize(toFixedString(s, 153)), 'distant', 'distant') AS w FROM numbers_mt(20000000) FORMAT Null</query>
</test>