Improve update_cleared_playfield_tiles performance #61
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.
Re-implements
update_cleared_playfield_tiles()
to walk over the playfield with a single pointer instead of keeping indices. Also optimizes the math and logic as much as I think is possible while keeping it only in C.This brings the entire sweep from 141747 to 113467 cycles (~20% or ~30000 fewer cycles) in some test scenario. This probably saves a frame or two during the sweep.
Performance while iterating over a completely unmarked playfield improves by about 10%.
Performance while iterating over a playfield with 44 marked tiles improves by about 27%.
The more tiles which are marked, the more noticeable the improvement would be.