Poor performance on screen-sized sprites that share a Z Index

I originally encountered this error when using playdate.graphics.sprite.setBackgroundDrawingCallback however I found it to be true of any screen-sized sprites that share a Z Index.

In this image captured from my game, you can see general CPU performance deteriorates when two sprites share a Z index - at either -32768 or even at 10. Once the sprites are put upon separate layers (at 10 & 11), the CPU utilization drops.

Curiously, I expected the performance to be fixed once the sprites were side-by-side instead of overlapping... however that was not the case. Here we see a baseline of sprites that are on different Z Indexes, followed by side by side sprites and overlapped sprites - both with additional CPU usage.

These performance issues were incredibly unexpected and difficult to track down. Another curious thing is that this doesn't seem to be an issue with smaller sprites (say, 50x50).

I'd like to do some benchmarking on a fresh project but haven't gotten around to it. Just curious if this was a known limitation or if others have experienced this as well?

Thanks

2 Likes