Skip to content

Improve mustachio deduplication strategy #3906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

srawlins
Copy link
Member

Currently mustachio has a very rudimentary deduplication strategy that leaves a fair number of unused partial render functions dangling in the generated code. This is because we delete a partial renderer function without taking great care about what partial functions it might have rendered, and which maybe are no longer rendered. This occurs particularly with deduplicated renderer functions that then don't become used any more.

This change introduces a renderer cache and a more formal 'reference-counting' strategy to know if a renderer becomes unused. Tracking all renderer functions (and the compilers that compiled them, and the used context stacks determined by compilers) in one place makes it possible to have a more accurate understanding of what renderer functions become unused through the deduplication process.

The new strategy is documented pretty well in this change, in the README.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Currently mustachio has a very rudimentary deduplication strategy that leaves a
fair number of unused partial render functions dangling in the generated code.
This is because we delete a partial renderer function without taking great care
about what partial functions it might have rendered, and which maybe are no
longer rendered. This occurs particularly with deduplicated renderer functions
that then don't become used any more.

This change introduces a renderer cache and a more formal 'reference-counting'
strategy to know if a renderer becomes unused. Tracking all renderer functions
(and the compilers that compiled them, and the used context stacks determined
by compilers) in one place makes it possible to have a more accurate
understanding of what renderer functions become unused through the
deduplication process.

The new strategy is documented pretty well in this change, in the README.
@srawlins
Copy link
Member Author

CC @keertip this is related to the other docs PR that you reviewed 😁

@srawlins srawlins merged commit dd226fe into dart-lang:main Oct 17, 2024
7 checks passed
@srawlins srawlins deleted the deduplicate-better-2 branch October 17, 2024 20:54
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.

2 participants