Skip to content

Blade: add deduplicateAcrossViews option to cap view-data emissions#352

Draft
janedbal wants to merge 1 commit intomasterfrom
jn-blade-deduplicate-across-views
Draft

Blade: add deduplicateAcrossViews option to cap view-data emissions#352
janedbal wants to merge 1 commit intomasterfrom
jn-blade-deduplicate-across-views

Conversation

@janedbal
Copy link
Copy Markdown
Member

Summary

  • Adds opt-in usageProviders.blade.deduplicateAcrossViews flag (default false).
  • When enabled, each class reachable through Blade view data emits its member usages at most once across the whole analysis run, instead of once per view() call site.
  • For codebases with many view call sites passing the same Eloquent models, this collapses emitted usages from O(call_sites × subtree_size) down to O(subtree_size) — directly addressing the RAM/usage explosion reported in Extension is unusable / crashes without displaying anything #349.

Tradeoff

Off by default because it loses per-call-site diagnostic precision: a dead view-bound method now reports only one example call site (whichever Blade visited first), rather than every site. Dead-code detection itself stays correct — a member with ≥1 emission is alive.

Twig is unaffected: the shared TemplateViewDataTraverser takes the flag per-call, and Twig's two call sites pass nothing (default false).

When enabled, each class reachable through Blade view data emits its
member usages at most once across the whole analysis. For codebases
with many view() call sites that pass the same Eloquent models, this
collapses the emitted-usage count from O(call_sites * subtree_size)
down to O(subtree_size), addressing the RAM/usage explosion reported
in #349.

Off by default — opt-in trades per-call-site diagnostic precision for
significantly lower memory use.
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