C Programming

Duff’s Device Is a Lie. Here’s the Truth.

Duff’s Device is revered as the most elegant optimization in C history — a switch-case fused with a do-while loop to unroll iteration. But on the very systems it was designed for, it was often slower than the naive loop it replaced. The real lesson isn’t about cleverness. It’s about the discipline of benchmarking and the danger of revering patterns instead of measuring them.

Lua Is Overrated. Meet Pico, The 10KB VM That Does What Lua Can’t.

Lua dominates embedded scripting, but for truly constrained systems — 10KB or less of free RAM — it’s overkill. Pico is a radical minimalist C VM that eschews garbage collection, modules, and coroutines to deliver a clean, embeddable scripting runtime. It’s not a Lua killer; it’s the tool Lua can never be for the edge.