Skip to content

Avoid redundant source parsing during docstring extraction - #4

Merged
trissim merged 1 commit into
mainfrom
codex/perf-direct-docstring-parse
Oct 3, 2026
Merged

trissim merged 1 commit into
mainfrom
codex/perf-direct-docstring-parse

Conversation

@trissim

@trissim trissim commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

DocstringExtractor.extract() read and parsed callable source even though both AST and fallback branches returned the same _parse_docstring() result. This removes that redundant work, preserving dynamic __doc__ handling and all existing parser behavior.

The OpenHCS advanced tutorial invoked extraction 2,211 times in one compile. Direct parsing matched DocstringInfo for 114 real CellProfiler callables; 20 passes took 0.075 s versus 1.429 s before. In a targeted A/B/A check, ExampleFly compilation was 3.989 → 2.260 → 3.976 s (old/direct/old), and advanced segmentation was 6.259 → 3.176 → 6.303 s.

The full 30-case one-well OpenHCS sweep completed successfully: all 30 compiled faster; compilation sum fell from 100.065 to 58.632 s (41.4%). Observed total sum fell from 375.020 to 311.858 s. Execution and startup differences were not attributed to this compile-only patch. The python-introspect suite passes (127 tests).

Closes #3. Downstream submodule update: OpenHCSDev/openhcs#175.

@trissim
trissim marked this pull request as ready for review September 29, 2026 06:46
@trissim
trissim merged commit 13f6ff3 into main Oct 3, 2026
9 of 12 checks passed
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.

Avoid redundant source and AST parsing during docstring extraction

1 participant