Memoize MatchKeywordFlags function #1507
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.
MatchKeywordFlags is currently called on every Sum, More, Flag, Override, List and Tabulate call so ends up being called hundreds of thousands of times when running the gem DPS sort and also a lot when running the tree node sort
At the start of each initEnv we have a fresh cache and store each unique Keyword flag match so it can quickly be used in a lookup instead of computed over and over again saving a ton of band calls
Link to a build that showcases this PR:
https://maxroll.gg/poe2/pob/xl17ge0c
Before screenshot:
After screenshot:
Used with #1504

Compared to dev
~250ms improvement on Fresh load
~130ms improvement after JIT cache is warm
Compared to #1504
~190ms further improvement on Fresh load
~100ms further improvement after JIT cache is warm