Managed to Unmanaged C++ Performance

G

Guest

I am exposing a legacy unmanaged C++ class library and deciding whether to
use COM or .NET approach. I have a COM DLL containing the legacy (unmanaged)
code, and a .NET class library containing the legacy code. My initial
performance testing showed .NET much slower than COM when executing the same
unmanaged code. After some investigation I see that I seem to be spending
significant time doing CArray::SetData() calls in the unmanaged code within
the .NET class library. If I break out the legacy code into a separate
unmanaged DLL, and simply access it from the .NET class library, the same
CArray::SetData() calls are orders of magnitude faster, and the .NET approach
now challenges the COM approach performance. Can anyone explain this
behavior?
 
C

Cor Ligthert [MVP]

MC

There will always be parts that can be done by one runtime quicker than
another runtime or native code.

However did you try this in a real hug application.
A simple native program will certainly win from managed code however as soon
as it grows, that will go in an opposite direction, because nobody can code
efficient with only native code.

Just my idea,

Cor
 

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