Performance with MS Vis C++ 2005 and /clr
This question is about native C++ efficiency when compiled together with .NET CLR
So I posted it here instead of the Windows forum. But may be I am wrong.
Please tell me if I well undesrtood:
If I a build a Windows Form using the designer and after I add much C/C++ native code which I want to be compiled to machine instructions (not MSIL) which run faster, I have to use the /clr compiler option and then use
#pragma managed([push,] on | off)
to force compiler to machine instructions when I want it
(1) But why doesn't the compiler compile all native code to machine instruction as a default if that runs faster?
(2) Does switch between machine instructions and MSIL consume much time? I guess it's quite difficult to evaluate when this switch makes loose more time than the one gained by using machin instructions
(3) I guess that a background thread not dealing with GUIs, written in native C++, is for sure convenient to be compiled with #pragma unmanaged directive ?