Skip to content

Commit 182d722

Browse files
committed
Document the per-assertion parsing cost
Each assertion builds its own parser and walks the whole class set, so the cost is linear in the number of rules: measured on 619 files, one pass takes ~2s and ten rules take ~20s, while the CLI parses once and checks every rule against the result. Only document it here. The fix is a memoizing Parser decorator, and that implements a core interface over core types, so it belongs in phparkitect/phparkitect next to FileParser, where the CLI and any other integration get it too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FE8ESEV7TzGLDwJuTfdq95
1 parent b55061c commit 182d722

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ reference:
6565
Anything you can express in a `phparkitect.php` config file works here unchanged. Baselines and the
6666
other CLI-only options do not — for those, keep using `vendor/bin/phparkitect check`.
6767

68+
## Performance
69+
70+
Every assertion parses the class set from scratch, so the cost grows linearly with the number of
71+
rules: one pass over ~600 files takes about 2 seconds, so ten rules cost about 20. The CLI does not
72+
work this way — it parses each file once and then checks every rule against it, which makes extra
73+
rules essentially free.
74+
75+
Keep your class sets narrow (`ClassSet::fromDir(__DIR__.'/../src/Domain')` rather than the whole
76+
`src/`), and reach for the CLI when you have many rules over a large codebase. Removing this
77+
difference means teaching the core analyzer to reuse parsed files across runs, which belongs in
78+
`phparkitect/phparkitect` rather than here.
79+
6880
## Compatibility
6981

7082
PHP 8.0–8.5, PHPUnit 9.6/10/11/12, PHPArkitect `^1.0`. Every combination is exercised in CI.

0 commit comments

Comments
 (0)