-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize sprite.c #3175
Optimize sprite.c #3175
Conversation
Counts the time spent in the block in arbitrary time units (64-cycles currently). If the block takes more than ~4 million cycles (~0.25s) the benchmark will wrap around. Note that the time can be affected by the timeout IRQs, and should only be taken as a loose indication of relative performance.
736349f
to
1351524
Compare
Note, this PR contains #3172. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad news 😬
The game softlocks randomly during the intro.
I think I found the culprit—I had a |
Yeah, that must've been it. The game plays fine now |
Is that PR ready to review then? Or will you be replacing it with this one? |
Whoops! Yeah, I've marked it as ready. I had it draft just in case anything came up with this PR, but I didn't make any changes :) |
Then I would mark this PR as draft until that one is approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition I compared the implementation in a somewhat non-scientific way to the implementation ipatix made for sots, and it is pretty comparable speed-wise for the small toy examples I played with :)
I think once this PR gets approved we can just have it supersede #3172 - alternatively we can merge that and you can rebase if you think it is useful to have that logical distincion :) |
tbh I don't think the logical distinction is that important, I'll just rebase this branch once I've applied your suggestions. I'll aim to do that next week, I'm very busy with work for the coming few days. |
2745053
to
b08b6a3
Compare
Addressed review comments, rebased, and pushed :) |
Optimizes
BuildOamBuffer
:Uses quicksort.Uses insertion sort with minimal writes for better performance on mostly-sorted data (which sprites typically are).u32
key which is computed up-front.sSpriteOrder
andsSpritePriorities
and the replacement lives in IWRAM (on the stack).gDummyOamData
to OAM slots that aren't already dummied.