The Playdate's CPU is fast, but its 4KB instruction cache will punish your code
Dirty Optimization Secrets (C for Playdate)
A developer shares hard-won optimization tricks for Playdate C programming, learned while building a full-speed Game Boy emulator. The key insight: the Playdate's CPU is fast but memory access is slow, and its tiny 4KB instruction cache means -Os can beat -O3. The post covers custom linker scripts, placing code and data in tightly-coupled memory, and fighting the 'performance lottery' caused by cache misalignment and branch prediction.
The first thing I did to improve performance for gameboy emulation was to squeeze the 20 kb emulator core into just 2 kb by removing a giant switch table and expressing it using much less code with just a few branches. The behaviour was identical, but it was much faster as a result.