lufia2ac: improve performance of access rules #2456
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 is this fixing or adding?
Modifies various access rules in the lufia2ac world with the aim of making them evaluate quicker.
Instead of having to determine the reachability of another location, they now only have to count items in state, which is faster.
(Also made it reuse the identical lambda for multiple locations, which might save a smidgen of memory.)
"But el_, why didn't you rewrite everything using regions?"
Not sure if much faster, the current benchmark PR is not entirely suitable to compare that. Anyway, the location access rules should at least be reasonably fast now at least.
Also, introducing more regions would probably have made the world code slightly more involved, while I'd argue that this PR instead makes the code more readable.
So I'll leave it like that for now and we can see whether further changes might be worthwhile in the future.
How was this tested?
#2433
Before:
After: