Re: C++ /clr vs. unmanaged C++
- From: "Ben Voigt [C++ MVP]" <rbv@xxxxxxxxxxxxx>
- Date: Fri, 1 Aug 2008 13:53:21 -0500
"Escri" <Escri@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:D6C1B83D-9699-44F3-A48B-F9A35A1399C4@xxxxxxxxxxxxxxxx
Hi,
If I build a (MFC) application with /clr but I don't add any C++/CLI code,
only pure C++ code, will there be differences in runtime compared with
building an unmanaged application?
Yes. In general the /clr version will use more memory and start slower. The throughput may or may not be similar.
As far as I understand, the CLR will take the /clr application, JIT compile
it and pass it to the native system. So the only difference would be when and
who generate the machine code. Is this correct?
Essentially, but the JIT compiler is also responsible for optimization. The JIT can do more cross-module optimization than the native C++ compiler, but the C++ compiler considers a lot more optimizations, only some of which are used when generating IL. In general the native code generated by the C++ compiler will be better optimized than the JIT. Also, when compiling /clr without using .NET features, you don't take advantage of the .NET memory management scheme (which is generally faster than the default C++ allocators) which usually compensates for the reduced optimization.
Overall I expect you'll see a performance penalty enabling /clr.
Thanks in advance
.
- Next by Date: Re: Windows Shell to find installed Apps
- Next by thread: Re: Windows Shell to find installed Apps
- Index(es):
Relevant Pages
|