473,500 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance impact: C# vs C++ classes

I have a library if C functions that will eventually get wrapped in a class.
The question is, should i wrap them in a C++ wrapper and call the wrapper
from C# or should I wrap the C functions in a C# wrapper? Anybody got any
insight on this? My primary goal is speed. This is an audio application that
can get pretty cpu intensive depending on how the user has it configured...
Nov 16 '05 #1
4 1481
If you just need to make the C functions accesible from .NET, I'd
suggest creating a C# wrapper that PInvokes the functions. If
performance is critical you'll want to make very coarse grained
functions. The overhead of switching from manged code to unmanaged
code can be high - not something you'd want to do inside a tight loop
in perf critical situation.

--
Scott
http://www.OdeToCode.com

On Fri, 3 Sep 2004 16:25:36 -0400, "Chuck Bowling"
<ch**********@sbcglobal-NO-SPAM.net> wrote:
I have a library if C functions that will eventually get wrapped in a class.
The question is, should i wrap them in a C++ wrapper and call the wrapper
from C# or should I wrap the C functions in a C# wrapper? Anybody got any
insight on this? My primary goal is speed. This is an audio application that
can get pretty cpu intensive depending on how the user has it configured...


Nov 16 '05 #2
Dear Chuck,

Swig might ease your task : http://www.swig.org/

Regards,
Bart

"Chuck Bowling" wrote:
I have a library if C functions that will eventually get wrapped in a class.
The question is, should i wrap them in a C++ wrapper and call the wrapper
from C# or should I wrap the C functions in a C# wrapper? Anybody got any
insight on this? My primary goal is speed. This is an audio application that
can get pretty cpu intensive depending on how the user has it configured...

Nov 16 '05 #3
Bart, I took a look at SWIG and it looks very interesting. I'll have to look
closer before I can decide if it'll be useful for what I'm doing, but in
either case it looks good. Thanks for the link.

"Bart" <Ba**@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
Dear Chuck,

Swig might ease your task : http://www.swig.org/

Regards,
Bart

"Chuck Bowling" wrote:
I have a library if C functions that will eventually get wrapped in a class. The question is, should i wrap them in a C++ wrapper and call the wrapper from C# or should I wrap the C functions in a C# wrapper? Anybody got any insight on this? My primary goal is speed. This is an audio application that can get pretty cpu intensive depending on how the user has it configured...

Nov 16 '05 #4
Thanks for the reply Scott. I'm aware that most of the overhead is in
switching from unmanaged to managed. Mainly I was interested in finding out
if there might be any performance gain in switching to managed in C++
classes as opposed to PInvoke and C#.

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:9l********************************@4ax.com...
If you just need to make the C functions accesible from .NET, I'd
suggest creating a C# wrapper that PInvokes the functions. If
performance is critical you'll want to make very coarse grained
functions. The overhead of switching from manged code to unmanaged
code can be high - not something you'd want to do inside a tight loop
in perf critical situation.

--
Scott
http://www.OdeToCode.com

On Fri, 3 Sep 2004 16:25:36 -0400, "Chuck Bowling"
<ch**********@sbcglobal-NO-SPAM.net> wrote:
I have a library if C functions that will eventually get wrapped in a class.The question is, should i wrap them in a C++ wrapper and call the wrapper
from C# or should I wrap the C functions in a C# wrapper? Anybody got any
insight on this? My primary goal is speed. This is an audio application thatcan get pretty cpu intensive depending on how the user has it configured...

Nov 16 '05 #5

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

Similar topics

5
4670
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to...
12
8317
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
2
2587
by: 1944USA | last post by:
I am re-architecting a C# application written as a multithreaded Windows Service and trying to squeeze every bit of performance out of it. 1) Does the thread that an object is instantiated on...
7
1665
by: Magnus | last post by:
Im using the new binding features of Visual Studio 2005. I have done the steps to create a bound data source, and selected all 40 tables from the database. The wizard generated the necessary code...
11
11125
by: Raja Chandrasekaran | last post by:
Hai folks, I have a question to get exact answer from you people. My question is How Static class is differ from instance class and If you use static class in ASP.NET, ll it affect speed or...
1
2769
by: dandorey1 | last post by:
I'm currently in the process of writing a realtime telephony application. I've designed it with a fairly simply plugin architecture. When I first started reading about this the general suggestion...
5
2186
by: lister | last post by:
Hi all, I have a fairly diverse range of data that I want to cache in the session rather than pulling it from the database on every page refresh. The problem is is that it seems that PHP...
14
2024
by: Sugandh Jain | last post by:
Hi, The warning from Microsoft.Performance Code Analysis check that, its not required to initialize numeric variables to zero, boolean to false and object to null is a good one because CLR does...
2
1640
by: Mirko Dziadzka | last post by:
Hi all I'm playing around with metaclasses and noticed, that there is small but mesurable a performance difference in the code shown below. With a more complex example I get a 5 percent...
0
7014
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
7180
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
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
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,...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.