Here http://msdn.microsoft.com/msdnmag/issues/05/01/CQA/, Paul DiLascia
described a method to ensure which parts of your application compiles as
managed and which as native.
Here http://msdn.microsoft.com/msdnmag/issues/05/01/COptimizations/, there
is information about how to get the best perfomance when calling native code
from managed. Read the section titled 'Native and Managed Code in a Single
Image'

Signature
Un saludo
Rodrigo Corral Gonz?lez [MVP]
FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
Troy - 23 Feb 2005 16:53 GMT
Thanks for the references. I had read Kang's "Power your app..." article.
The primary tip is avoiding or minimizing thunking - especially double
thunking. Given that there are no managed calls in my app and all code is
compiled under #pragma unmanaged directives, I would not expect any thunking
to occur.
Paul's article has some good tips on how to omit modules from being /clr
compiled, which I'm sure I'll use, but I'm still confused about the true
affect of #pragma unmanaged when compiled with /clr.
If all of my code is compiled under that directive and there are is
absolutely no managed code in the project, shouldn't performance be close to
native? I got an email response from a person that suggested several C++
optimizations are disabled when compiled with /clr. But the performance
difference is substantial - more than I would attribute to optimizations, or
lack thereof.
Thanks for your help. I'm not trying to be stubborn - just trying to
understand.
- Troy
----------
> Here http://msdn.microsoft.com/msdnmag/issues/05/01/CQA/, Paul DiLascia
> described a method to ensure which parts of your application compiles as
[quoted text clipped - 4 lines]
> from managed. Read the section titled 'Native and Managed Code in a Single
> Image'
Troy - 23 Feb 2005 16:55 GMT
Thanks for the references. I had read Kang's "Power your app..." article.
The primary tip is avoiding or minimizing thunking - especially double
thunking. Given that there are no managed calls in my app and all code is
compiled under #pragma unmanaged directives, I would not expect any thunking
to occur.
Paul's article has some good tips on how to omit modules from being /clr
compiled, which I'm sure I'll use, but I'm still confused about the true
affect of #pragma unmanaged when compiled with /clr.
If all of my code is compiled under that directive and there are is
absolutely no managed code in the project, shouldn't performance be close to
native? I got an email response from a person that suggested several C++
optimizations are disabled when compiled with /clr. But the performance
difference is substantial - more than I would attribute to optimizations, or
lack thereof.
Thanks for your help. I'm not trying to be stubborn - just trying to
understand.
- Troy
----------
> Here http://msdn.microsoft.com/msdnmag/issues/05/01/CQA/, Paul DiLascia
> described a method to ensure which parts of your application compiles as
[quoted text clipped - 4 lines]
> from managed. Read the section titled 'Native and Managed Code in a Single
> Image'
Troy - 24 Feb 2005 22:07 GMT
Sorry for the double-post. The site errored out on me and I thought it
didn't take the first one.
I sort of figured out my performance problem. I was using AtlTrace to send
frame counts to the debug output window. That was the performance killer.
It seems that when a project is compiled managed, the debug output goes
through managed objects, even for unmanaged code such as AtlTrace. (This is
just a guess, but the only conclusion I can draw.)
The good news is once that trace call was removed the performance was nearly
identical with or without the /clr switch.
Thanks, again, for your response Rodrigo.
- Troy
> Thanks for the references. I had read Kang's "Power your app..." article.
> The primary tip is avoiding or minimizing thunking - especially double
[quoted text clipped - 28 lines]
> > from managed. Read the section titled 'Native and Managed Code in a Single
> > Image'