Sunday, March 28, 2010

A funny debugging story

As I'm debugging, something funny popped into my head that happened at work a while back, which prompted me to test something different than I usually do.

At work, two years or so ago, we were starting to see slowdown in one of our games, and we simply couldn't figure it out. The particular game was less complex than our other games, but it was running so much slower that it was starting to become unplayable.

Then, one day, I noticed this tiny little line at the very top of the screen. It must have only been one pixel. I hovered over it, and I got the text cursor. I thought 'huh, that's odd'. So, I clicked, then hit ctrl+A, and ctrl+C. Went over to notepad and hit ctrl+V. You know what I found?

The transcript for war and peace was printing on every line!

Nah, I jest about that - but the amount of debugging text that was being printed to the screen in a place it couldn't be seen but was still required to process was of a similar size (text takes up a lot of space in a vector engine, it's about the only thing that's more efficient to do raster-based, AFAIK)

So, here we are, wondering why everything is slowing down, and I go into the code, toggle off 'display debug', and run it. *BAM* it's running so fast we have to go in and decrease the framerate. It's funny how that worked.

I say this because my previous blog I realize - hey, what if my slowdown is coming from all the traces I'm putting in, whenever I run the game I'm running it in debug mode.

The answer: Makes no difference. Good to know, though.

No comments:

Post a Comment