Jump to content
  • Advertisement
Sign in to follow this  
seejenn

Difference between Debug and Release code...

This topic is 4503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Gamedev, Earlier, there was a thread that discussed the difference between running in debug and release mode. From what I understood from the thread, it's expected that running in release mode would be much faster than running in debug mode. But I'm experiencing the opposite. My code compiled in debug mode is running much faster than the one compiled in release mode. Would you know what could be causing this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Could you provide any more information, or perhaps the code that you have profiled and seen to be faster in debug? How exactly are you profiling the code too? It is a bit odd to have your code performing better in debug than release builds, but it could be many things.

Share this post


Link to post
Share on other sites
Quote:
Original post by seejenn
Hi Gamedev,

Earlier, there was a thread that discussed the difference between running in debug and release mode. From what I understood from the thread, it's expected that running in release mode would be much faster than running in debug mode. But I'm experiencing the opposite. My code compiled in debug mode is running much faster than the one compiled in release mode. Would you know what could be causing this?

Thanks.


One quick thing to remember for debug vs release.

In release mode all asserts are dropped, which means the followign code will work in debug but not releae:
assert(pointer++)

There is a way around this, a simple way i just dont remember..

Share this post


Link to post
Share on other sites
All my code does is retrieve data from the database and format everything into an output flat file. I can't post the code here as I'll be breaking company policy but it's just a simple retrieve-format-output process. I'm not sure why it's running longer in release mode than in debug mode. i'm not even sure if i have to rewrite the whole thing. That sucks.

Share this post


Link to post
Share on other sites
I noticed that the release mode run is not eating up as much of the CPU as the debug mode run. Is this expected? Or is this what's causing it to run slower? I don't know how to run the profiler against my code. Need help.

Share this post


Link to post
Share on other sites
Oh, yeah...
I wonder, my program never crash (throws exception) in debug mode. But, when I change it to Release code, it always crashes ! What should I do ?
BTW, I use VC++ 6.0 SP6

Share this post


Link to post
Share on other sites
EonStrife, its probably uninitialized variables, your debugger fills them with values when running in debug, but in release, if you don't initialize them, they contain whatever might have been at this place in memory before it got instanciated.

Share this post


Link to post
Share on other sites
xErix, thanks. But, I think that VC++ won't compile (or generate error messages) if I use uninitialized variables...Hence, I won't be able to run the program in debug mode if I do that...

Share this post


Link to post
Share on other sites
Quote:

In release mode all asserts are dropped, which means the followign code will work in debug but not releae:
assert(pointer++)

There is a way around this, a simple way i just dont remember..


I'd say the easiest way around it is to not write asserts that affect the code:

assert(pointer);
pointer++;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!