Optimized SongInit a bit #1

Closed
emoon wants to merge 1 commits from song-init-opt into main
emoon commented 2022-12-28 16:53:45 +01:00 (Migrated from github.com)

I just had a quick look at the code and noticed the mul with 15 and figured that it can be replaced with shift + sub instead. I haven't done any testing of this code, but I figured I could just do a PR with it and you use it if you want.

If I done my math right it saves 20 cycles each iteration, but it does add 4 bytes in size.

I just had a quick look at the code and noticed the mul with `15` and figured that it can be replaced with shift + sub instead. I haven't done any testing of this code, but I figured I could just do a PR with it and you use it if you want. If I done my math right it saves 20 cycles each iteration, but it does add 4 bytes in size.
chrisly42 commented 2022-12-28 19:00:31 +01:00 (Migrated from github.com)

Thanks for looking into it. SongInit is optimized for size, not for speed, especially as this case is called at most 23 times. Filesize is two bytes larger, but the shrinkled size three bytes more, so I'd rather not change the code as I see no benefit.

Thanks for looking into it. SongInit is optimized for size, not for speed, especially as this case is called at most 23 times. Filesize is two bytes larger, but the shrinkled size three bytes more, so I'd rather not change the code as I see no benefit.

Pull request closed

Sign in to join this conversation.
No description provided.