Compiling unmanaged code as managed

O

Omid Hodjati

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.
 
T

Tanveer Gani [MSFT]

--------------------
Content-Class: urn:content-classes:message
From: "Omid Hodjati" <[email protected]>
Sender: "Omid Hodjati" <[email protected]>
Subject: Compiling unmanaged code as managed
Date: Tue, 2 Sep 2003 22:20:47 -0700
Lines: 25
Message-ID: <[email protected]>
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: AcNx2yHnRYVsMb4QTQOWkdtbYKkWag==
Newsgroups: microsoft.public.dotnet.languages.vc
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:27846
NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
X-Tomcat-NG: microsoft.public.dotnet.languages.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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top