Skip to content

perf(discovery): skip composer.json probes for manifest-cached packages - #27

Merged
brianvarskonst merged 2 commits into
mainfrom
perf/discovery-reuse-manifest-metadata
Oct 23, 2026
Merged

brianvarskonst merged 2 commits into
mainfrom
perf/discovery-reuse-manifest-metadata

Conversation

@brianvarskonst

Copy link
Copy Markdown
Member

Finding

Review finding K-P3: bundle discovery runs on every request. The manifest cache already saves getInstalledPackages() and the composer.json parsing, but composerBundle() and requirementsActive() still called is_file() on every package composer.json before using the cached metadata. KernelPackageManifestCache::read() had just validated exactly those files through their recorded fingerprints (inputs).

Change

BundleDiscovery::knownComposerFile() probes the filesystem only for files the manifest does not know. Everything else in discovery is unchanged: the active-package resolution still runs (it depends on active_plugins), bundle instantiation and the RequiredBundle reflection stay.

The remaining per-package cost on a warm hit is one getInstallPath() lookup from Composer's in-memory data, the activity check and the bundle constructor; persisting the sorted bundle list itself was not worth a new manifest format.

Verification

Bundle, discovery and cache suites pass; composer cs and composer static-analysis pass in a PHP 8.5.12 container.

brianvarskonst and others added 2 commits October 23, 2026 23:48
On a manifest cache hit every package's composer.json was still stat()ed before
its cached metadata was used, although the manifest fingerprint check had just
validated the same file. Probe the filesystem only for files the manifest does
not know.
@brianvarskonst
brianvarskonst merged commit 3981680 into main Oct 23, 2026
3 checks passed
@brianvarskonst
brianvarskonst deleted the perf/discovery-reuse-manifest-metadata branch October 23, 2026 22:32
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