optimize "manager wide" constant rewriting #159
Merged
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.
What does this PR do?
Most constant editors are actually "manager wide", meaning that they target all programs under a given manager. Currently when rewriting this kind of constants we iterator over all constant entries, then for each program we create an editor that does the edition. The issue is that creating an editor iterates over all instructions searching for "references", and thus we do a lot of repetitive work (and it's starting to show up in profiles, especially in test profiles were we continuously restart the manager).
To improve this situation this PR reverses the order of iteration for "manager wide" constants by creating an editor only once per program.
Motivation
What inspired you to submit this pull request?
Additional Notes
Anything else we should know when reviewing?
Describe how to test your changes
Write here in detail how you have tested your changes and instructions on how this should be tested.