Skip to content
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

Optimized _TransparentPlot_ASM for speed* #28

Merged
merged 1 commit into from
Oct 18, 2016
Merged

Optimized _TransparentPlot_ASM for speed* #28

merged 1 commit into from
Oct 18, 2016

Conversation

runer112
Copy link
Member

Unrolled each of the opaque and transparent braches into four iterations, so stretches of the same pixel opaqueness/transparency mostly fall through the jumps and execute faster.

Before (12 bytes):

  • opaque->opaque: 41 cc
  • opaque->trans: 36 cc
  • trans->opaque: 46 cc
  • trans->trans: 41 cc

After (54 bytes; lists cycles after 1/2/3/4 mod 4 iterations in a row of previous pixel state):

  • opaque->opaque: 36/36/36/41 cc
  • opaque->trans: 41/41/41/36 cc
  • trans->opaque: 38/38/38/46 cc
  • trans->trans: 33/33/33/38 cc

Starts on the fast transparent path based on the assumption that the majority of transparent sprite pixel rows start with a transparent pixel, as transparency is often used to draw "cutout" images.

Unrolled each of the opaque and transparent braches into four iterations, so stretches of the same pixel opaqueness/transparency mostly fall through the jumps and execute faster.

Before (12 bytes):
 * opaque->opaque: 41 cc
 * opaque->trans: 36 cc
 * trans->opaque: 46 cc
 * trans->trans: 41 cc

After (54 bytes; lists cycles after 1/2/3/4 mod 4 iterations in a row of previous pixel state):
 * opaque->opaque: 36/36/36/41 cc 
 * opaque->trans:  41/41/41/36 cc
 * trans->opaque: 38/38/38/46 cc
 * trans->trans: 33/33/33/38 cc

Starts on the fast transparent path based on the assumption that the majority of transparent sprite pixel rows start with a transparent pixel, as transparency is often used to draw "cutout" images.
@runer112
Copy link
Member Author

Untested; would appreciate if someone could at least take a second look and check that it looks reasonable.

@mateoconlechuga mateoconlechuga merged commit 4fe6aa2 into CE-Programming:master Oct 18, 2016
@mateoconlechuga
Copy link
Member

Thanks! :)

@runer112
Copy link
Member Author

For the record: @mateoconlechuga tested this with an example program using transparent sprites and said that it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants