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
SUMMARY: Performance "Optimize inbounds check and reactor lookup."
Purpose of change
Did some profiling, these two methods came up at the tippy top of the profile when spending a lot of time waiting or sleeping.
Describe the solution
generic_inbounds was creating and destroying a ton of tripoint objects while summing coordinates, so extracted the math to just sum integer values instead.
map::inbounds was also doing a lot of math to create it's bounding boxes since it took my_MAPSIZE as an input. Created a second inbounds method for tinymap so that each variant could use a compile-time constant value.
Vehicle code was spending a lot of time checking wether parts were reactors, so I added reactors to the list of flags cached in a bitset.
Describe alternatives you've considered
First I made the inbounds check templated, but it looks like that didn't help significantly, the real issue was the operations used and the excessive tripoint creation.
Impact
These methods accounted for roughly 30% of the execution time when the game was running in fast forward mode (waiting, crafting, sleeping). These changes should make long-action processing roughly 50% faster.