Speed up inventory lint: opt-in fast frontend patches + parallel cached bin/lint.php (#16077)#16394
Open
PurHur wants to merge 2 commits into
Open
Speed up inventory lint: opt-in fast frontend patches + parallel cached bin/lint.php (#16077)#16394PurHur wants to merge 2 commits into
PurHur wants to merge 2 commits into
Conversation
6d2e4f1 to
fee8fe2
Compare
This was referenced Jul 5, 2026
58c822f to
9790223
Compare
…ed bin/lint.php (#16077). Three vendored-frontend algorithmic fixes, shipped as patches/ (diffed against the fully-patched files, applied last by apply-patches.sh): - php-cfg-simplifier-use-chain.patch: Simplifier::replaceVariables via the operand's recorded usages/write-ops instead of re-walking the whole CFG per removed phi (O(phis x blocks) -> O(uses); 121s -> 0.8s on lib/Compiler.php). Opt-in: PHPCFG_SIMPLIFIER_USECHAIN=1. - php-types-resolver-worklist.patch: TypeReconstructor::resolve() as a dependency-driven worklist instead of full re-scan rounds (types phase 40s -> 7s on lib/Compiler.php). Opt-in: PHPTYPES_RESOLVER_WORKLIST=1. - php-cfg-operand-usage-dedup.patch: addUsage/addWriteOp O(1) dedup via spl_object_id sets instead of linear scans (always on — pure dedup, no ordering change). The two order-changing paths are OPT-IN, defaulting to the legacy walks: resolution/replacement ORDER is observable in AOT codegen (phi operand types — caught by check-aot-build-smoke tier 1 before this PR went up). bin/lint.php turns them on for lint workloads via putenv, where output equivalence is proven: identical lint issues on lib/VM.php, lib/Compiler.php, lib/JIT.php + the full 4037-file inventory cold run matching the committed table. PHP_COMPILER_LINT_FRONTEND_FAST=0 opts lint back out. bin/lint.php --bootstrap-inventory also gains a per-file result cache (build/lint-cache/, keyed by file sha1 + linter fingerprint) and parallel worker fan-out (--worker-stdin, PHP_COMPILER_LINT_JOBS, default nproc-2), with inline re-lint of any file a worker fails to report. PHP_COMPILER_LINT_CACHE=0 opts out. Inventory gate measured in the pinned container: sequential 2h+ -> 50m10s cold (6 jobs) -> 0.47s warm re-run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…#16354 fixed). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9790223 to
fcc65c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16077 (the 2h+ inventory lint gate).
Vendored-frontend algorithmic fixes (patches/)
Simplifier::replaceVariablesvia the operand's recorded usages/write-ops instead of re-walking the whole CFG per removed phi: O(phis×blocks) → O(uses), 121s → 0.8s on lib/Compiler.php. Opt-inPHPCFG_SIMPLIFIER_USECHAIN=1.TypeReconstructor::resolve()as a dependency-driven worklist instead of full re-scan rounds: types phase 40s → 7s. Opt-inPHPTYPES_RESOLVER_WORKLIST=1.addUsage/addWriteOpdedup via spl_object_id sets (always on; pure dedup, no ordering change).check-aot-build-smoketier 1 caught it during validation, exactly the failure class it was built for).bin/lint.phpenables them via putenv for lint workloads only, where output equivalence is proven: identical issues on lib/VM.php, lib/Compiler.php, lib/JIT.php, and a full 4037-file inventory cold run matching the committed table.PHP_COMPILER_LINT_FRONTEND_FAST=0opts lint back out.Parallel + cached inventory lint (bin/lint.php)
build/lint-cache/, keyed by file sha1 + linter fingerprint over lint.php/Linter.php/composer.lock/unsupported-syntax.md);PHP_COMPILER_LINT_CACHE=0opts out.--worker-stdin,PHP_COMPILER_LINT_JOBS, default nproc−2); any file a worker fails to report is re-linted inline so a crash cannot drop findings.Measured (pinned container)
Verified: patches apply cold from pristine vendor and skip idempotently;
check-aot-build-smokerc=0 with default paths; VMTest-tier equivalence via identical lint output legacy vs fast.🤖 Generated with Claude Code