How much faster is C than Lua for Playdate development?

As I've been learning C and working on various Playdate projects, I've been wondering: just how much faster is C than Lua for Playdate games? :playdate_question:

OpenFL and some other libraries out there have used a benchmark called Bunnymark that bounces a bunch of bunnies around on the screen in increasing amounts to see when frames start to drop. So I built a similar version for Playdate in both Lua and C.

pdbunnymark

Max stable bunnies:

30 FPS 50 FPS
Lua 240 120
C 810 430
Ratio 3.4× 3.6×

Key takeaway: Based on this one approach and benchmark, it C seems to be about 3.5x faster than Lua on Playdate.

This isn't the most robust and scientific experiment. And it's really focused on a draw-heavy workflow. But it's interesting nonetheless!

While I don't think this is revelatory (it's known that C will be more performant), I think knowing the difference is helpful when undertaking a project that might need to squeeze out as much performance as possible.

Reference and inspiration:

By comparison, on my M2 MacBook Pro, I get about 55,000 bunnies in Tetra (Rust +
SDL3) before frames start to drop.

For those curious, the source is available here:

And the v1.0 release .pdx files are available to download here: Release v1.0 · brettchalupa/pdbunnymark · GitHub

19 Likes