1. Can anyone suggest a (free) C++ profiler? I am using Microsoft Visual C++ 6.0.
2. Is;
Code:
temp = 20h;
__forceinline void ADC()
{
A += temp;
}
the same speed wise as;
Code:
__forceinline void ADC( unsigned char data )
{
A += data;
}
ADC(temp);
3. I know you've heard this before but is there anyway of forcing a C++ compiler to make a switch/case table a jump table?
1. If you use mingw32 or cygwin, you will have gcc's gprof profiling facilities available to you.
2. The thorough answer: it depends on the compiler, architecture, and context of the code. Most architectures push arguments to the stack, but the inlining avoids that. The storage class of temp is not given in this example, and it's possible that it may have to be reloaded. If your compiler is braindead or you are in a debug build, the argument to ADC may be masked, and then shift/masked on funtion entry.
2. The shorter answer: probably.
3. Most compilers turn dense switch statements into jump tables, and not a long chain of if/else. But again, your compiler, optimization settings, and architecture all affect the code generation.
I'm not sure if this will help your question but Microsoft is offering express editions of their new IDE's for free at
http://msdn.microsoft.com/vstudio/express/default.aspx.