473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C# -> C++ Performance

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

Jun 28 '06 #1
3 1619
Hello Toadfather,

Are your C++ functions sufficiently speedy on their own already?

I see two things.. First, COM interop in .NET is always going to be slow.
Specifically COM object instantiation.

Second, XML parsing is a tad slow as well.

The XML parsing is probably unavoidable, but try to limit the COM interop
as much as possible.

-Boo
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

Jun 28 '06 #2
What exactly hinders the performance?
C# XML parsing, C++ XML parsing or IPC?

for any case there are different solution - from changing the way of parsing
data to zipping message and sending in between apps
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)


--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 28 '06 #3

"Toadfather" <ze******@chavey.net> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
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?)
This is definitely a good way to improve performance.
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?
This is the quickest and easiest. You have two options if combining with
#1:
Recompile as native (almost zero effort needed) -- the new C++ compilers
have improved optimizers, may help some.
Recompile with /clr. This will invoke the C++.NET "It Just Works" feature
and compile to MSIL. Is your C++ code purely data massaging, or does it
make Win32 API calls (network, file, etc)? If you are only working with the
data, then using /clr:pure will eliminate the managed-unmanaged transitions
for some more gain. If you are doing I/O or using other COM objects, etc,
then you will want to use #pragma managed/#pragma unmanaged to minimize the
number of transitions.
4. Re-architect C++ code (no quick win)
Here it may be worthwhile to refactor the code a little bit. Any rework you
do should be with the goal of preventing the following scenario:
Your managed C++ wrapper copies a 10 megabyte string to unmanaged memory,
and calls the original C++ function, which takes one look at an integer
parameter, chooses not to use that massive string for some other reason.
Try to cache the converted strings. Try to work on the strings in Unicode
to avoid conversion.

Thanks all

Jun 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: john | last post by:
Hi I am devlopeing a data centric intranetsite with data in mysql database I would like your opinion on this architecture Data will be fetched from database by python & converted into xml The...
4
by: jason | last post by:
I would appreciate some help on how to convert a database table into an html file via FSO and whether more seasoned asp programmers recommned this route. The main reason I am attempting to do this...
129
by: Torbjørn Pettersen | last post by:
I've started cleaning up my HTML and implementing CSS. So far I've used FrontPage, but am switching over to DreamWeaver. Reading a bit on W3Schools.com and W3.org I see there are a lot of HTML...
3
by: ctk70 | last post by:
I'm trying to run a ASP.NET 1.1 app on a Windows 2003 server. The app runs fine on my local workstation (Windows 2000 SP4). Both the server and workstation have Visual Studio .NET 2003 installed. ...
1
by: Rosny | last post by:
From the article http://software.newsforge.com/software/05/01/27/170244.shtml?tid=132&tid=75&tid=131&tid=13 "Flickr runs on MySQL, the most popular open source database, and it has from the...
3
by: Olaf Rabbachin | last post by:
Hi *, ich erzeuge zur Laufzeit in einer ASP-Tabelle Tabellenzellen. Im Großteil dieser Zellen befinden sich Checkboxes. Per JS ändere ich beim Click auf eine solche Zelle oder deren Checkbox die...
11
by: Richard Maher | last post by:
Hi, I have read many of the copius entries on the subject of IE performance (or the lack thereof) when populating Select Lists. I don't mind the insert performance so much, (I get 100x120byte...
0
by: Imran | last post by:
JOB ID: BE 3001 Please refer to the Job ID in all your communication both in subject line of your email and in the body text. Hi Friends, Good Morning ,...Hope you doing good! Our client needs...
43
by: john | last post by:
Hi, in TC++PL 3 on pages 674-675 it is mentioned: "Maybe your first idea for a two-dimensional vector was something like this: class Matrix { valarray< valarray<doublev; public: // ... };
11
by: Mahdi | last post by:
Hi This seems like a crazy question but I wanted to find out if anyone knows which one of those two conditions are better (faster, smaller memory footprint, can be optimized by the compiler,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.