Skip to content

Read package dependencies as the traversal visits them - #1308

Closed
andreybolonin wants to merge 2 commits into
crazywhalecc:v3from
andreybolonin:perf/load-dependencies-on-visit
Closed

andreybolonin wants to merge 2 commits into
crazywhalecc:v3from
andreybolonin:perf/load-dependencies-on-visit

Conversation

@andreybolonin

Copy link
Copy Markdown

What does this PR do?

getSubDependencies() and getResolvedPackageClosure() currently build a dependency map for the entire resolved package set on every call. Read dependency fields when the traversal visits a package. The traversal still filters edges through the resolved set and retains the ordering of required dependencies, overrides, and suggestions.

This applies to link dependency lookup in the framework on all supported platforms. The package configuration format, recipes, toolchains, and public CLI behavior stay the same. The regression test covers overrides on a transitive dependency, filtering an override outside the resolved set, and deduplication across roots.

On macOS arm64 with PHP 8.6.0, a benchmark using the built-in registry and a PHP build graph with eight extensions reduced the median time for 8,000 closure queries from 387 ms to 190 ms (−51%). Median peak RSS went from 40.61 to 40.56 MiB. The incremental peak PHP heap dropped from 26.8 to 8.5 KiB. Baseline and candidate returned identical results in the benchmark.

Checklist before merging

  • composer cs-fix
  • composer analyse
  • composer test
  • bin/spc dev:lint-config

The benchmark isolates dependency lookup. Full static builds and other host platforms were outside local validation. Documentation updates are unnecessary because the lookup behavior stays the same.

private static function visitSubDeps(
string $pkg_name,
array $dep_map,
array $dependency_overrides,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I can see this functionality is not even needed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, is needed

Cover a FrankenPHP root that reaches PHP transitively. Its linker flags must still include the libraries of PHP's static extensions and virtual SAPIs.
@andreybolonin

andreybolonin commented Nov 29, 2026 •

Copy link
Copy Markdown
Author

@henderkes you dont understand the point of this PR?

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.

3 participants