Why is a second visible layer so expensive?

I’m finding a take a major CPU hit as soon as I make the title layer visible; the effects I’m running drop by half in framerate.

I added a hack to fillRefreshRow to bail on any hardwareY outside the 12 or so rows I cared about, thinking that would be a big optimization, but it didn’t make much difference.

Merely having the layer in the chain with non-zero brightness seems expensive… can anyone explain why so I can better understand it?


It could be that adding a layer uses up some of the faster memory in the ESP32 and starts using more inefficient memory stored on a slower bus. Or maybe forcing some other non-layer memory to be allocated in the inefficient region.

What type of layer are you adding? I think the GFX layers I wrote more recently are more CPU efficient. Though your test doesn’t make it sound like it’s per-pixel CPU usage that’s slowing things down

I found that calling swapBuffers with FALSE on copy pretty much fixes it, so it must be the additional work for copying the swap buffers around. With it set to false I have to redraw the entire frame each time, but its much faster.

You could be right that I’m working in slower memory and it’s also exacerbated by needing to copy it around…