Debug faster than release

Started by
7 comments, last by tomva 14 years, 2 months ago
Hey, I have usually found answers to my questions on google but this problem is so weird that I need some real professional help! I have been developing a concurrent simulation/game engine with C++ in Linux and compiling with gcc. The performance was quite good ~6000 Boids at 50 fps. A week ago I started a larger renovation and now the performance is 81 Boids at 30 fps.... + the debug build is actually Faster than release. My larger headache is that the debug is faster than release. Do anyone have any clue about this?
Advertisement
I'm not a Linux or gcc person so I don't know if it's a possibility, but are you, perhaps, using the debug library for the release exe?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Quote:Original post by Buckeye
I'm not a Linux or gcc person so I don't know if it's a possibility, but are you, perhaps, using the debug library for the release exe?


Would be very happy if it was that simple. I haven't changed anything about how I build or which libraries...
Are you using threading? the timing differences between release code running faster than debug code can bring out some really strange bugs if you didn't write proper threading code.
Quote:Original post by KulSeran
Are you using threading? the timing differences between release code running faster than debug code can bring out some really strange bugs if you didn't write proper threading code.


Yes, I'm using pthreads to separate the engine into several concurrent components/threads. That was interesting and I will look into it (even if I haven't changed anything with the threading)...
I guess by "release" under gcc you mean compiled with -O2? That might sound stupid, but be sure to clean and rebuild everything, sometime it fail to rebuild some files and gives strange result. Of course, if you use multiple threads and they are constantly waiting for mutex lock, it will slow things down.
You went from 6000 boids @ 50 fps to 81 @ 30 fps and are worried that the debug version is faster?

I don't know what your goal is, but I would simply revert all those changes and start from scratch...
You might have heap corruption if it still runs faster in debug. Otherwise, who knows, could be many things.

This is my thread. There are many threads like it, but this one is mine.

I agree with other posters: the performance degradation is pretty severe and release vs. debug probably isn't the best symptom to be chasing at this point.

I'd guess that some code path is being triggered or missed in debug, and that's why the performance is so different between debug and release.

But the first step is to profile and find where the time is going. I'm always surprised at how, when I measure performance problems, the results are quite different from what I was expecting when I started.

If you don't have a good profiling setup, you can always back out all your changes and add back in pieces at a time until you find the change that is causing the problem.

This topic is closed to new replies.

Advertisement