Sign in to follow this  
Myownbitch

Debug faster than release

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this