Skip to content

Commit 8fcf159

Browse files
tenpercentclaude
andcommitted
Replace hardcoded recommendations with data-driven insights
Instead of generic boilerplate advice, generate specific actionable recommendations based on the actual analysis data: High-Impact Targets (by total time): - Show top 5 templates with actual times and percentages - Recommend strategy based on patterns: - High count (>100) → Extern templates - High individual cost (>50ms) → Template specialization - Otherwise → Explicit instantiation Frequently Instantiated (>100 times): - Identify templates compiled repeatedly - Recommend PCH or extern templates Most Expensive Individual Instantiations: - Show top 3 specific instantiations to profile - Point to exact templates consuming most time Example before (useless): "Focus on High-Impact Templates: Address top 10 families first" Example after (actionable): "TensorDescriptor - 4.2s total (18.1%) - 2,546 instantiations, 1.65ms average - Strategy: Extern templates - High instantiation count" Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4b8471b commit 8fcf159

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

.claude/skills/templates/build_analysis_report.md.jinja

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,31 @@
6363

6464
## Optimization Recommendations
6565

66-
### Short Term
67-
1. **Focus on High-Impact Templates**: Address top 10 families first
68-
2. **Explicit Template Instantiation**: Pre-instantiate common configurations
69-
3. **Extern Templates**: Mark frequently-used templates as extern in headers
70-
71-
### Medium Term
72-
1. **Precompiled Headers**: Include heavy templates in PCH
73-
2. **Template Specialization**: Replace general templates with specialized versions
74-
3. **Template Depth Reduction**: Simplify template hierarchies
75-
76-
### Long Term
77-
1. **Architectural Review**: Evaluate necessity of deep template metaprogramming
78-
2. **C++20 Concepts**: Earlier constraint checking, fewer instantiations
79-
3. **Build Caching**: Distributed build cache for template instantiations
66+
### High-Impact Targets (by total time)
67+
{% for name, stats in templates_by_time[:5] -%}
68+
**{{ loop.index }}. {{ name }}** - {{ (stats.total_dur|us_to_s)|round(1) }}s total ({{ stats.pct|round(1) }}%)
69+
- {{ stats.count|format_number }} instantiations, {{ (stats.avg|us_to_ms)|round(2) }}ms average
70+
{% if stats.count > 100 -%}
71+
- Strategy: Extern templates - High instantiation count suggests repeated compilation
72+
{% elif stats.avg|us_to_ms > 50 -%}
73+
- Strategy: Template specialization - High individual cost suggests complexity
74+
{% else -%}
75+
- Strategy: Explicit instantiation - Pre-instantiate common configurations
76+
{% endif %}
77+
78+
{% endfor %}
79+
### Frequently Instantiated (optimization candidates)
80+
{% for name, stats in templates_by_count[:5] if stats.count > 100 -%}
81+
**{{ name }}** - {{ stats.count|format_number }} times ({{ (stats.total_dur|us_to_s)|round(2) }}s total)
82+
- Consider: Precompiled headers or extern templates to avoid recompilation
83+
84+
{% endfor %}
85+
### Most Expensive Individual Instantiations
86+
{% for inst in top_individual[:3] -%}
87+
**{{ loop.index }}. {{ inst.detail|truncate(60) }}** - {{ (inst.dur|us_to_ms)|round(1) }}ms
88+
- Strategy: Profile and simplify this specific instantiation
89+
90+
{% endfor %}
8091

8192
## Detailed Statistics
8293

0 commit comments

Comments
 (0)