dumb optimization trick

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
dumb optimization trick
by on (#218391)
I was looking at ways to save memory for object slots and I got it down to 84 bytes. What I found special about this number is that it's slightly less than 256/3. If I page align every 3rd object slot, direct page instruction will be 1 cycle faster for every 3rd object.
Re: dumb optimization trick
by on (#218399)
I was thinking of the same thing, actually... :lol: Another little trick is that I like to have it to where the end of a loop is when an index register is 0, so I don't need a cmp instruction.
Re: dumb optimization trick
by on (#218400)
Now I need to find a way to always have objects spawn into the page-aligned slots first so they have a higher chance of being in a page-aligned slot. Using a linked-list object slot system makes this more difficult.

I could probably take this one step further and have slow slot objects move into fast slots when a free fast slot becomes available.