Skip to content

Conversation

@tenpercent
Copy link
Contributor

@tenpercent tenpercent commented Jan 19, 2026

Summary

  • Add BUILD_TIME_OPTIMIZATION.md documenting techniques for reducing C++ template instantiation overhead
  • Covers: O(1) pack expansion, named functors, constexpr arrays, fold expressions
  • Includes before/after code examples and metrics from the optimization PRs

Tracking issue: #3575

@tenpercent tenpercent force-pushed the mpodkory/build-time-docs branch 11 times, most recently from 80c4f97 to 71413bd Compare January 20, 2026 01:14
@tenpercent tenpercent requested a review from shumway January 20, 2026 18:46
@afagaj afagaj requested a review from Copilot January 20, 2026 22:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive documentation on build time optimization techniques for reducing C++ template instantiation overhead in the Composable Kernel codebase. The documentation targets the heavy use of template metaprogramming which can significantly impact compilation times.

Changes:

  • Documents four key optimization strategies: pack expansion, named functors, constexpr loops, and fold expressions
  • Provides before/after code examples with real metrics from previous optimization efforts
  • Explains the computational complexity improvements and their practical impact on build times

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tenpercent tenpercent force-pushed the mpodkory/build-time-docs branch 5 times, most recently from e814786 to ad15f55 Compare January 20, 2026 23:34
@tenpercent tenpercent force-pushed the mpodkory/find-transform-optimization branch 2 times, most recently from ec8e794 to 83a76d7 Compare January 22, 2026 01:13
This document describes techniques for reducing C++ template instantiation
overhead in the Composable Kernel codebase, including:

- Replacing recursive templates with pack expansion (O(N) → O(1) depth)
- Using named functors instead of lambdas to share instantiations
- Replacing template recursion with constexpr loops
- Using fold expressions for accumulation operations

These techniques can significantly reduce build times for template-heavy code.
@tenpercent tenpercent force-pushed the mpodkory/build-time-docs branch from ad15f55 to b63bfd9 Compare January 23, 2026 18:57
@tenpercent tenpercent changed the base branch from mpodkory/find-transform-optimization to develop January 23, 2026 18:58
@cgmillette cgmillette self-assigned this Jan 23, 2026
Copy link
Collaborator

@shumway shumway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks for the work rewriting this, it's really clear and helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants