I started long ago with plain C, then moved to C++ and now I'm facing C++/CLI. As a performance freak, I'm always trying to squeeze the last drop of performance to every line of code. I'm currently in a project that makes sense to be done mostly in VB.Net (simplicity, resource availability, etc.), but has a few points that are very performance sensitive and I was planning to do those parts in C++/CLI. However, only a tiny portion of it can be taken out from managed code, while the rest needs to be kept managed. The question is, is there any performance gain to be expected by writing a C++/CLI managed function comparing to C# or VB.Net? From what I could understand from the docs I've been reading, the only advantage seems to be that managed/unmanaged thunking is lighter. Is that the case? Because I can't even seem able to store handles in unmanaged arrays or structures (which I could manipulate faster), like:
String ^ mystr = "Oh, my!";
Object ^ myarray[10];
myarray[0] = mystr; // Can't event be casted to void*, int, HANDLE...
// (however, handles do have a sizeof() == 4 in Win32)
// (I don't expect the handle to behave like a pointer; just stay as handle)