mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
## Summary - Replace Pydantic frozen dataclass with stdlib `@dataclass(frozen=True)` for `CodeExplanationAndID` and `CodeAndExplanation`, removing `field_validator` that ran `.code` + `compile()` ~280 times per pipeline run - Pre-compute `original_module.code` once and pass to pipeline steps (`clean_extraneous_comments`, `equality_check`) that previously called it independently - Replace `ast.dump(annotate_fields=False)` with `ast.unparse` in `deduplicate_optimizations` (70% faster) - Skip re-parse in `dedup_and_sort_imports` when isort returns unchanged code - Cache comment-stripped original code across candidates in `clean_extraneous_comments` **Pipeline median per-run: ~1.5s → 184ms** (4 candidates, controlled measurement). Saves ~4-5s of CPU per optimization request in production. ## Test plan - [x] All 558 unit tests pass - [x] mypy clean - [x] ruff clean (no new warnings) - [ ] Verify optimizer endpoints return correct results in staging --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| aiservice | ||
| .dockerignore | ||