C++ – Evaluating CLR/C++ vs Native C++

\clrcvisual c++

How should I go about evaluating the performance or execution time of C++ with CLR versus native C++?

My personal bias is that I believe C++ with CLR to be slower since it has to run on a virtual machine. I will also admit that I have never really been a fan of Visual C++ due to the syntax that has been added, so I wanted to know how to evaluate the performance of the two approaches and determine which is provably faster instead of relying only on my biases.

Best Answer

I did some benchmarks in the past on my own, and my experience was that native C++ was around a factor 2 faster than C++/CLI for my typical business case, without any relevant change in code - your mileage will vary. For me, a factor 2 was almost always fully acceptable to stick to C++/CLI side, because interaction with the .NET framework and other .NET code was much more important for me than this performance gain.