Skip to content

Implementation Plan: Perf — Add CDumper for YAML Writes + Hoist re.compile() to Module Level#2200

Merged
Trecek merged 4 commits into
developfrom
perf-add-cdumper-for-yaml-writes-hoist-re-compile-to-module/2189
May 7, 2026
Merged

Implementation Plan: Perf — Add CDumper for YAML Writes + Hoist re.compile() to Module Level#2200
Trecek merged 4 commits into
developfrom
perf-add-cdumper-for-yaml-writes-hoist-re-compile-to-module/2189

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 7, 2026

Summary

Two independent micro-performance fixes: (A) use the C-extension CDumper for YAML writes in dump_yaml_str() instead of the pure-Python dumper (~5× speedup), mirroring the existing CSafeLoader pattern for reads; and (B) hoist two re.compile() calls from inside @semantic_rule function bodies to module-level constants in rules_ci.py, since the patterns are static and those rules run on every validate_recipe() call (131 rules total).

Requirements

Labels: recipe:implementation

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/impl-20260507-150035-838422/.autoskillit/temp/make-plan/perf_add_cdumper_yaml_hoist_re_compile_plan_2026-05-07_150500.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
plan claude-sonnet-4-6 1 125 7.8k 497.3k 55.9k 46 46.9k 2m 54s
verify claude-sonnet-4-6 1 84 7.8k 422.2k 61.8k 29 49.0k 2m 26s
implement* MiniMax-M2.7-highspeed 1 384.5k 5.8k 645.0k 70.6k 52 51.9k 2m 18s
prepare_pr* MiniMax-M2.7-highspeed 1 101.7k 5.2k 329.9k 35.1k 25 22.7k 1m 58s
compose_pr* MiniMax-M2.7-highspeed 1 66.7k 1.4k 265.1k 29.8k 18 15.1k 47s
review_pr claude-sonnet-4-6 1 84 31.7k 371.4k 66.0k 32 56.1k 6m 16s
resolve_review claude-sonnet-4-6 1 217 9.9k 1.2M 60.8k 61 47.8k 6m 51s
Total 553.5k 69.6k 3.7M 70.6k 289.5k 23m 31s

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
plan 0
verify 0
implement 67 9626.8 774.1 86.1
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 8 151703.5 5979.9 1241.1
Total 75 49926.3 3860.1 928.5

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
claude-sonnet-4-6 3 359 21.2k 1.6M 133.4k 14m 5s
MiniMax-M2.7-highspeed 3 553.0k 12.3k 1.2M 89.7k 5m 3s

Trecek and others added 4 commits May 7, 2026 15:09
- Add _Dumper (CDumper if libyaml available, else Dumper) to core/io.py
  and use it in dump_yaml_str() for ~5x faster YAML serialization
- Move no_runs_re and timed_out_re regex compilation to module level in
  rules_ci.py to avoid recompiling on every validate_recipe() call
- Add tests for _Dumper type detection and module-level regex constants

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…comment

Add pattern string assertions to test_no_runs_re_is_module_level_constant and
test_timed_out_re_is_module_level_constant so a silent regex change cannot pass.
Remove the section-divider comment that added no navigational value.
…rror

A caller passing Dumper= in **kwargs would cause yaml.dump to raise TypeError
for duplicate keyword argument. Pop it before forwarding to make the function
safe against callers using dump_yaml_str as a transparent yaml.dump wrapper.
@Trecek Trecek added this pull request to the merge queue May 7, 2026
Merged via the queue into develop with commit ba2bf5a May 7, 2026
2 checks passed
@Trecek Trecek deleted the perf-add-cdumper-for-yaml-writes-hoist-re-compile-to-module/2189 branch May 7, 2026 23:04
Trecek added a commit that referenced this pull request May 8, 2026
…mpile() to Module Level (#2200)

## Summary

Two independent micro-performance fixes: (A) use the C-extension CDumper
for YAML writes in `dump_yaml_str()` instead of the pure-Python dumper
(~5× speedup), mirroring the existing CSafeLoader pattern for reads; and
(B) hoist two `re.compile()` calls from inside `@semantic_rule` function
bodies to module-level constants in `rules_ci.py`, since the patterns
are static and those rules run on every `validate_recipe()` call (131
rules total).

## Requirements

**Labels**: `recipe:implementation`

## Implementation Plan

Plan file:
`/home/talon/projects/autoskillit-runs/impl-20260507-150035-838422/.autoskillit/temp/make-plan/perf_add_cdumper_yaml_hoist_re_compile_plan_2026-05-07_150500.md`

🤖 Generated with [Claude Code](https://claude.com/claude-code) via
AutoSkillit
<!-- autoskillit:pipeline-signature
steps=prepare_pr,run_arch_lenses,compose_pr,annotate_pr_diff,review_pr
-->

## Token Usage Summary

| Step | Model | count | uncached | output | cache_read | peak_ctx |
turns | cache_write | time |

|------|-------|-------|----------|--------|------------|----------|-------|-------------|------|
| plan | claude-sonnet-4-6 | 1 | 125 | 7.8k | 497.3k | 55.9k | 46 |
46.9k | 2m 54s |
| verify | claude-sonnet-4-6 | 1 | 84 | 7.8k | 422.2k | 61.8k | 29 |
49.0k | 2m 26s |
| implement* | MiniMax-M2.7-highspeed | 1 | 384.5k | 5.8k | 645.0k |
70.6k | 52 | 51.9k | 2m 18s |
| fix | claude-sonnet-4-6 | 1 | 150 | 5.5k | 680.1k | 50.5k | 45 | 37.6k
| 8m 44s |
| prepare_pr* | MiniMax-M2.7-highspeed | 1 | 101.7k | 5.2k | 329.9k |
35.1k | 25 | 22.7k | 1m 58s |
| compose_pr* | MiniMax-M2.7-highspeed | 1 | 66.7k | 1.4k | 265.1k |
29.8k | 18 | 15.1k | 47s |
| **Total** | | | 553.3k | 33.5k | 2.8M | 70.6k | | 223.1k | 19m 8s |

\* *Step used a non-Anthropic provider; caching behavior may differ.*

## Token Efficiency

| Step | LoC Changed | cache_read/LoC | cache_write/LoC | output/LoC |
|------|-------------|----------------|-----------------|------------|
| plan | 0 | — | — | — |
| verify | 0 | — | — | — |
| implement | 67 | 9626.8 | 774.1 | 86.1 |
| fix | 2 | 340049.5 | 18780.5 | 2760.0 |
| prepare_pr | 0 | — | — | — |
| compose_pr | 0 | — | — | — |
| **Total** | **69** | 41153.0 | 3233.7 | 485.9 |

## Model Usage Breakdown

| Model | steps | uncached | output | cache_read | cache_write | time |
|-------|-------|----------|--------|------------|-------------|------|
| claude-sonnet-4-6 | 3 | 359 | 21.2k | 1.6M | 133.4k | 14m 5s |
| MiniMax-M2.7-highspeed | 3 | 553.0k | 12.3k | 1.2M | 89.7k | 5m 3s |

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant