// JP opened flex table

Click to See Complete Forum and Search --> : Code optimization


m.g. Boshu
July 16th, 1998, 05:31 AM
We are facing a assertion failure in an application, when the code optimizations in the project settings, is changed from default to "maximize speed". This creates a problem both in release and debug version of the application.

what may be the reason ?.

what is the difference between release and debug versions in terms of performance and memory management.


thanking in advance

m g boshu

Volker Annuss
July 27th, 1998, 10:43 AM
Try to disable inline expansion.


Shomething like the following code did not compile correct with inline expansion enabled.


z = Int64ShllMod32( Int64ShllMod32( x, 32 ), y );


Volker

Xu xing jian
November 28th, 1998, 04:07 AM
I have the same problem,I want to get answer too.


Xu xing jian

11.28

Rob Wainwright
April 10th, 1999, 03:33 PM
There is a significant difference between the debug and release builds of software (even if you don't use options such as maximise speed). There are many articles (see MSJ) which say which optimisations can give problems. Unless you're prepared to start reading the assembler to hand check routines that have been "optimised" by the compiler, I'd strongly suggest not to use any at all. You are likely to get more improvements in performance through tuning the algorithms you use, then worrying about clock cycles.

There is an interesting chapter in "Code Complete" which discusses optimisations and how to crank up code speed

Eddy Ho
April 16th, 1999, 05:09 PM
Well, if you know where the exception came from you can disable or enable ceratin part of your program by using #pragma optimize("", on) or optimize("", off). There are other options that you can put in the "". Just check it out in the MSDN.
eg.
funcA()
{
...
}

#pragma optimize("", off) // turn off all optimization here
// Note that this is per-function basis.
funcB()
{

}
#pragma optimize("", on) // turn back on

The biggest difference that I can think of between release and debug build is that initialization is not made for release build whereas in the debug build the compiler init. your vars and other stuff (new memory etc... correct me if I'm wrong). That's why you might have assertion. The assembly code is different between the 2 builds. Just compile your code with code listing turn on(Settings->C/C++->Category->Listing Files), just do comparison with the code produced by Release and Debug and u'll see what I mean (Your code is sometimes rearrange for efficiency, expression checking is different, blab...).

//JP added flex table