pently icon indicating copy to clipboard operation
pently copied to clipboard

Pattern loop point lookahead

Open pinobatch opened this issue 6 years ago • 0 comments

Profiling Pently (issue #5) reveals that more complex tracks cause CPU time spikes at the start of patterns, particularly "Isometry" which uses five play commands to start all five tracks at once and ends up taking roughly 3800 cycles. This can happen to a lesser extent if multiple patterns hit their loop point (PATEND in pattern bytecode) at the same time. So during downtime, look for the first track that may hit a play or PATEND on the next row and proactively (re)start it. This should help smooth out peaks other than on the first frame.

Also consider run this sort of lookahead in pently_start_music, which in some games may be done on a blank screen when worst-case CPU use isn't as critical.

pinobatch avatar Dec 24 '17 02:12 pinobatch