Commit a7f88a6
authored
Optimize _extract_type_names_from_code
## Refinement Summary
The optimization achieved a **35x speedup** (93.3ms → 2.65ms) primarily through lazy parser initialization. I refined the code by:
1. **Reverted micro-optimization**: Restored the intermediate `name` variable in `_extract_type_names_from_code`. This improves readability with no performance cost—the profiler shows no measurable difference.
2. **Preserved the core optimization**: Kept the lazy parser initialization via `@property`, which is the actual source of the dramatic speedup.
3. **Minimized diff**: Restored original formatting (blank lines, import style) to reduce unnecessary changes and match the original code style.
The refined optimization maintains the full performance benefit while improving code clarity and minimizing the diff from the original.1 parent 4ac49ee commit a7f88a6
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
724 | 731 | | |
725 | 732 | | |
726 | 733 | | |
| |||
0 commit comments