Managed to unmanaged performance

T

Toadfather

Hi all
Existing COM ATL DLL wrapping a C++ library. Interoping from a C#
application, passing a large string containng XML (5-130kb). Need to
significantly improve performance of both the interoping and the
performance of the native functions (performance critical app).

Opinions sought on most worthwhile course of action...have identified 4

options...

1. Implement a managed C++ wrapper and link to underling C++ functions,

marshalling non-native types where necessary. Thus eliminating COM
(quick win?)
2. Re-write C++ code in C#. (no quick win, not possible to re-write all

of it also)
3. Recompile C++ code with VC7 or higher (currently VC6)...quick win?
4. Re-architect C++ code (no quick win)

Thanks all
 
C

Cowboy \(Gregory A. Beamer\)

Before coding, find out precisely where the performance issue is. You need
to fully instrument your code and/or use tools that can give you a better
idea of the true performance bottleneck.

You also have to determine what is good enough, precisely. Without a Quality
of Service spec, you are shooting fish in the dark (apologies for the bad
idiom).

Moving from a COM based component to a native DLL may help you, but not if
the performance issue is the marshalling boundary. You may have a Ferrari on
one side and a Maserati on the other and the trip from car to car
(marshalling) may be the sticking point. While marshalling natively will
give you gains, and perhaps a "quick win", it may not be enough.

Rewriting will certain speed things up, but you have mentioned that it might
be possible that not all can be rewritten. If this is true, and marshalling
is your issue, you will not see gains here either.

Recompiling in VC7 might produce some gains due to improvements in the
compiler. As this si the easiest to test, I would do it regardless of any
other choices. If it does not speed up your code significantly, it still
cost you very little time. I am not sure how much you will gain, but the
compilers have gotten better.

Your final option, of sticking to C++ is a good choice. If speed is your
primary goal C is also an option, although there is a learning curve there.
C# is fast when compiled, but there is some overhead for the memory safety.
C++ is not as safe, but there is far less infrastructure to contend with.

All of these suggestions have merit, but you first have to figure out
precisely what your issue is. Coding before having a map of what is
acceptable and where you stand is not a wise idea.

Hope this helps.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 

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