Playdate.wait(0) slow down game

I noticed that calling playdate.wait(0) would have a dramatic impact on my framerate ( from 30 to 15 fps).

I would expect that this would not have any impact on the game.

import 'CoreLibs/utilities/printer'
import 'CoreLibs/sprites'
import 'CoreLibs/graphics'

white =
black =

local gameTime = 0

function playdate.update()
	gameTime = gameTime + 1 / playdate.display.getRefreshRate() white )
		200 + math.cos(gameTime)*70,
		120 + math.sin(gameTime)*70,

	playdate.drawFPS(5, 5)

	if playdate.buttonIsPressed(playdate.kButtonA) then
1 Like

@dave, does calling playdate.wait(0) cancel the next invocation of playdate.update()?

no, it yields the current call and takes another pass through the run loop, including waiting for the next frame. We should take the wait into account when we’re figuring out how low to GC/idle for between frames