Skip to content

Add -falign-loops=32 to stabilize benchmark results - #100914

Merged
alexey-milovidov merged 13 commits into
masterfrom
falign-loops-32
Apr 25, 2026
Merged

alexey-milovidov merged 13 commits into
masterfrom
falign-loops-32

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 27, 2026 •

Copy link
Copy Markdown
Member

We already use -falign-functions=64 and -mbranches-within-32B-boundaries to reduce performance sensitivity to code layout changes. Adding -falign-loops=32 extends this to loop headers: when a hot loop body shifts by a few bytes due to an unrelated code change, it can cross a cache-line or instruction-fetch boundary, causing a small but stable performance regression or improvement that has nothing to do with the actual change. Padding loop entries to a 32-byte boundary makes this much less likely.

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

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

Add -falign-loops=32 to stabilize benchmark results

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

We already use `-falign-functions=64` and `-mbranches-within-32B-boundaries`
to reduce performance sensitivity to code layout changes. Adding
`-falign-loops=32` extends this to loop headers: when a hot loop body shifts
by a few bytes due to an unrelated code change, it can cross a cache-line or
instruction-fetch boundary, causing a small but stable performance regression
or improvement that has nothing to do with the actual change. Padding loop
entries to a 32-byte boundary makes this much less likely.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e60cb39]

Summary: ✅


AI Review

Summary

This PR adds -falign-loops=32 alongside the existing -falign-functions=64 in CMakeLists.txt to reduce benchmark variance from code layout shifts. I did not find correctness, safety, compatibility, or maintainability issues in the change itself.

Missing context
  • ⚠️ CI is still in progress (several required checks are pending), so this review is based on code and metadata only.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ➖
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-build Pull request with build/testing/packaging improvement label Mar 27, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

This sounds very doubtful to me, but why not try?

@alexey-milovidov

Copy link
Copy Markdown
Member Author

No slower queries. So this change might help.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 25, 2026
@alexey-milovidov alexey-milovidov self-assigned this Apr 25, 2026
Merged via the queue into master with commit 65cc202 Apr 25, 2026
325 of 326 checks passed
@alexey-milovidov
alexey-milovidov deleted the falign-loops-32 branch April 25, 2026 15:48
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-build Pull request with build/testing/packaging improvement pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants