Slower performance in 1.1.0 compared to 1.0.8

My recent demo that was built with 1.0.8 SDK, and ran well on 1.0.8 device, runs much slower on 1.1.0 device.

With no code changes to my game I am getting much slower performance.

  • 1.0.8: steady 60fps
  • 1.1.0: uneven ~48fps

Notes

  • roughly an extra 3 or 4 milliseconds per update
  • I am also now seeing occasional frame stutters which I assume is GC?
  • such performance degradation is not visible in the Simulator as it runs much faster than the device, so I did not spot this running a 1.1.0-nightly (which I did not have on Device)

"Help!"

Am happy to assist in diagnosing.

Things I've tried

  • disable all synths (no change to frame rate)
  • sampler profiling (nothing jumps out)
  • GC changes/management (no change to frame rate)

Interesting finds

  • GC stutters in my game are from playdate.timer.updateTimers()with a single 1000ms timer
  • my frame utilisation is 80 to 90%, so I don't believe I'm running over allotted frame time

Hey Matt,

In 1.1 the minimum GC time was lowered from 5ms to 1 ms. Could you try upping it back to 5ms? playdate.setMinimumGCTime(5)

The fact that you're experiencing GC stalls makes me wonder if he game is falling behind and it's getting caught doing larger sweeps more often.

Hopefully you'll see some improvement from this.

Hi @marc,

I've just finished some tests around GC.

  • the only GC stall is from the timer, which I can disable in code to remove the timer stutter (because: no timer)

The GC stutter can also be eliminated through various means:

  • setting GC to 5ms does remove the timer stutter (in fact, 3ms seems to be enough)
  • disabling GC completely avoids the timer stutter (not sure of the long-term effect of this, though I do call collectgarbage() when loading/resetting levels which may be enough)

Sadly, none of these changes affect the reduction in frame rate.

Amazing, thanks for bringing this issue to our attention!

It seems like we had a bug slip in where once the outgoing framebuffer is marked as fully dirty, we will do full display updates on every frame after that.

I've put a fix in, and it'll be out in 1.1.1 in the near future.

1 Like

Thanks for the speedy diagnosis and fix @marc !

Also quite impressed my game can run at 48fps with full display updates. :astonished:

Confirmed as fixed using a test firmware. Thanks @dave !

My game loop now takes only 5ms, so I can run it at anything up to 200fps :flushed:

1 Like