Skip to content

Lazily prepare execution-server function catalog - #180

Merged
trissim merged 2 commits into
mainfrom
codex/perf-lazy-catalog
Sep 29, 2026
Merged

trissim merged 2 commits into
mainfrom
codex/perf-lazy-catalog

Conversation

@trissim

@trissim trissim commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

A fresh client-owned execution server currently builds the complete function catalog before binding, then waits for it again before running a pipeline. Converted CellProfiler pipelines import their functions directly, so that catalog work adds startup latency without helping their execution.

Bind the endpoint first and prepare the catalog on the first catalog request. Before evaluating pipeline source, inspect its imports and initialize the registry when it needs a registry-created virtual module; direct imports proceed without that global projection. Concurrent catalog and pipeline requests share one metadata load. This keeps catalog reads and external virtual imports available while shortening fresh execution startup.

On the same CPU-only integration checkout, the official30 one-well fresh-server sweep passed 30/30 and all 110 produced result files matched the control byte for byte. The sum of per-observation totals fell from 311.858 to 274.266 seconds (−37.592; all 30 cases faster, median −1.171 seconds). Non-job time fell by 58.822 seconds; compilation rose by 25.126 seconds as some registry work moved there. The execution-job difference is run variation and is not claimed as an effect of this patch. A live client fetched all 266 catalog functions on demand after connecting.

Raw CSVs, native-relative figures, and timing boundaries are included. Validation: 104 focused tests passed on this PR branch; Black and git diff --check passed. Ruff is not installed in the local benchmark venv.

Refs #165. This PR is stacked on #167 because it reuses the registry inventory lock added there. The benchmark checkout also contained other pending performance changes, including the direct-docstring dependency update in #175; only the lazy-catalog code changed between the paired CSVs.

Bind fresh-server startup to direct-import pipeline needs. Initialize the external virtual-module projection only when pipeline source imports it, and serialize concurrent metadata loading for catalog requests.

Refs #165
Save fresh-server 30-case timing, native-relative figures, and exact-output parity for the on-demand catalog change.

Refs #165
@trissim

trissim commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator Author

Issue #179 is being fixed by the blind-analysis integration owner on fix/compile-observation-identity-20260929. zmq_execution_server.py changes are confined to compilation_signature on ZMQExecutionContext, _resolve_compilation, and _store_compile_artifact. No function-catalog startup/preparation edits; your lazy-catalog ownership stays separate. _export_runtime_observation is unchanged (PR #157 owns that path).

@trissim
trissim marked this pull request as ready for review September 29, 2026 13:35
@trissim
trissim changed the base branch from codex/perf-cached-registry-inventory to main September 29, 2026 17:54
@trissim
trissim merged commit efe09d8 into main Sep 29, 2026
1 check failed
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