Skip to content

Optimized _TransparentPlot_ASM for speed*#28

Merged
mateoconlechuga merged 1 commit intoCE-Programming:masterfrom
runer112:opt/_TransparentPlot_Asm
Oct 18, 2016
Merged

Optimized _TransparentPlot_ASM for speed*#28
mateoconlechuga merged 1 commit intoCE-Programming:masterfrom
runer112:opt/_TransparentPlot_Asm

Conversation

@runer112
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

Thanks! :)

@runer112
Copy link
Copy Markdown
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