--------------------
Content-Class: urn:content-classes:message
From: "Omid Hodjati" <om**********@y ahoo.com>
Sender: "Omid Hodjati" <om**********@y ahoo.com>
Subject: Compiling unmanaged code as managed
Date: Tue, 2 Sep 2003 22:20:47 -0700
Lines: 25
Message-ID: <06************ *************** *@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcNx2yHnRYVsMb4 QTQOWkdtbYKkWag ==
Newsgroups: microsoft.publi c.dotnet.langua ges.vc
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:27846
NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc
Hi All,
I have an old unmanaged code written in C++ 6.0. This is a
time critcal, CPU bound application. I have deciede
migrate this application to managed world and VC++ 7.0.
The first step was to compile the 6.0 version with /clr to
IL code....That was succesful ... I made clean build !
But the application didn't run. When I profiled the
application execustion i saw that the managed version is 2
times slower that unmanaged version. This stoped me going
forward ...
I have not used and "managed material" in the application
yet. My code is not managed and then there must be no IL
in my PE and then no JITing (except some startup, i
think). I have not refereanced managed heap an then i
expect GC thread to be blocked during the execution....
-I expect the new aplication be, at least; as fast as the
old one. What causes this version to be so slow then ?
I have to ignore using managed environment if i can't find
the reasone.....coz my application is realtime and CPU
bound.
Thanks the help in advanced...
Omid.
Hi Omid,
When you compile with the /clr option, the VC++ compiler generates CIL
rather than native machine code that can be run immediately. The CIL is
usually translated to native machine code typically at load time by a
JIT-er but you can also pre-JIT this code using ngen.exe which comes with
the .NET SDK.
I'm not sure where the 2x slowdown is coming from, but it could simply be
due to the JIT-er not generating as efficient code as the native
VC++-generated code for some particularly time-critical loop.
A good place to get familiar with the managed world is this:
http://www.microsoft.com/net/
--
Tanveer Gani, Microsoft Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm