← Back to context

Comment by simias

7 years ago

I'm always trying to look smart but I don't always succeed.

Anyway, I'm not part of the industry but I do hack around in emulation circles and I've dug pretty deep in some of these old games, my point was that you can definitely end up with dead or almost-dead debug code that doesn't harm performance significantly (because it's never or almost never called) and lingers in the final binary.

>when you’re trying to push 60/120 frames per second nearly every switch statement is going to “cost” something

I mean it obviously depends on the frequency of the test. If you have some check every second that reads like:

    if (dump_stats) {
      dump_stats_to_stdout();
    }

Then it's obviously going to have a negligible impact performance-wise as long as enable_stats is false. Then if this code is not explicitly disabled in the production build you might be able to use a memory hack to switch enable_stats to true and get some potentially interesting output out of it.

This is not (just) me trying to look smart, it's stuff that you can actually encounter in some games and firmwares in the wild.