Skip to content

fix: cache repeated PHP and pkg-config queries - #759

Open
vencakrecl wants to merge 1 commit into
php:1.5.xfrom
vencakrecl:fix/cache-platform-queries
Open

vencakrecl wants to merge 1 commit into
php:1.5.xfrom
vencakrecl:fix/cache-platform-queries

Conversation

@vencakrecl

Copy link
Copy Markdown

Repeated pie install calls for already-installed extensions currently launch PHP and pkg-config hundreds of times. On macOS with Homebrew PHP 8.4.26 ARM64, the direct command in #758 took 46.19 seconds despite requiring no extension builds or updates.

Cache target-PHP query output per PhpBinaryPath instance and share pkg-config results across the platform repositories created for that target. Cache successful and missing-library queries, with the environment included in the pkg-config key. Refresh runtime information before extension verification and around install/uninstall operations, including failure paths; invalidate dependency information after attempted system-package installation.

Fixes #758.

Validation

  • Benchmarked a temporary copy of the installed PIE 1.5.1 PHAR with the patch, invoking PIE directly: 46.19 seconds → 5.30 seconds. All seven extensions remained already installed and verified.
  • Instrumented subprocess counts: 114 → 8 PHP launches, 810 → 54 pkg-config launches.
  • 67 affected unit tests completed with 141 assertions; 9 tests skipped for platform requirements. Additional cache regression coverage verifies runtime refresh, target isolation, missing-library caching, explicit invalidation, and environment changes.
  • 21 dependency resolver tests passed with 38 assertions when run with network access.
  • PHPStan and coding-standard checks passed. Tests/static analysis ran on macOS with PHP 8.5.11; the benchmark used PHP 8.4.26.
  • The complete unit suite was attempted, but did not pass in this environment: Packagist requests were blocked by the sandbox and sudo tests required an interactive terminal. The dependency resolver tests were subsequently rerun successfully with network access. Linux/Windows execution and real extension installation/removal have not been validated locally.

PR submitter checklist

This branch has not been deployed

No deployments
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