Skip to content

optimize WindowTransform for libcxx hardening - #95746

Closed
mstetsyuk wants to merge 1 commit into
masterfrom
optimise-WindowTransform-hardening
Closed

mstetsyuk wants to merge 1 commit into
masterfrom
optimise-WindowTransform-hardening

Conversation

@mstetsyuk

@mstetsyuk mstetsyuk commented Feb 1, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Performance Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Enabling fast libc++ hardening makes WindowTransform around 10% slower, according to ClickBench. This is because in many places it performs std::vector (or std::deque) random access for each processed row which, with libc++ hardening, also involves bounds checking.

To optimise WindowTransform, we need to get rid of superfluous std::vector (or std::deque) random accesses:

  1. Avoid calling WindowTransform::inputAt and WindowTransform::blockAt for every processed row. Reuse the result for each block.
  2. For WindowTransform::partition_by_indices, WindowTransform::order_by_indices, WindowFunctionWorkspace::argument_column_indices, use PODArray instead of std::vector.
  3. Do std::vector<...>::data() where necessary.

Even with libc++ hardening enabled, profiling shows >10% less CPU consumed in WindowTransform as a result of these changes.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh

clickhouse-gh Bot commented Feb 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d49d492]

Summary: ❌

job_name test_name status info comment
Build (arm_tidy) failure
Build ClickHouse failure cidb
Build (amd_debug) dropped
Build (amd_asan) dropped
Build (amd_tsan) dropped
Build (amd_msan) dropped
Build (amd_ubsan) dropped
Build (amd_binary) dropped
Build (arm_asan) dropped
Build (arm_binary) dropped
Build (arm_tsan) dropped

@clickhouse-gh clickhouse-gh Bot added the pr-performance Pull request with some performance improvements label Feb 1, 2026
@nickitat nickitat self-assigned this Feb 2, 2026
@mstetsyuk mstetsyuk closed this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-performance Pull request with some performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants