Following C++ instincts in C++/cli will lead to faster code than using C# instincts in C#, e.g. when looping through data. Sure, You CAN use unsafe C# code to accomplish the same thing and you CAN use arrays in C++/cli, but if instead you follow fairly standard language paradigms there can be a huge performance difference in the right circumstances, e.g. 10 to 1 in a tight loop with plenty of data access.
C++ paradigm in C++/cli
char * position = start;
char * end = position + data_count;
while ( position < start ) {
{ do stuff with the data )
position ++;
}
C# paradigm
for ( int i = 0 ; i < count; i ++ ) {
{ do stuff with data[i] )
}
Use the dissassembly window and you will see how very differently these compile.
Besides these programming paradigm issues there may be actual compiler issues, but I don't know anything about those.
answered 2011-06-28T19:34:54.853