Blade: add deduplicateAcrossViews option to cap view-data emissions#352
Draft
Blade: add deduplicateAcrossViews option to cap view-data emissions#352
Conversation
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.
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.
Summary
usageProviders.blade.deduplicateAcrossViewsflag (defaultfalse).view()call site.O(call_sites × subtree_size)down toO(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
TemplateViewDataTraversertakes the flag per-call, and Twig's two call sites pass nothing (defaultfalse).