473,698 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

performance using com dll witdh c#

Hi,

I have imported my com dll with Visual studios "Add reference", and then i'm
using this code:

private static MyComDll connectionKit = new MyComDll();

public static void CreateBatch(obj ect hBatch)
{ ...
connectionKit.C omCreateBatch(. ..)
}

public static void SendBatch(objec t hBatch)
{ ...
connectionKit.S endBatch(...)
}

I have no problem with my application, however i think the performance could
be better. Is there any better way to call methods in a com dll? I don't have
access to sourcecode for the dll-file.
Nov 16 '05 #1
4 1198
Jesper,

What do you mean call methods in a COM dll? You are calling methods on
an object that is a wrapper to the type in a COM server. That's about as
good as you are going to be able to get, since COM interop requires a good
number of operations for each call (I think the average is somewhere around
40).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jesper Nilsson" <Je***********@ discussions.mic rosoft.com> wrote in message
news:D1******** *************** ***********@mic rosoft.com...
Hi,

I have imported my com dll with Visual studios "Add reference", and then
i'm
using this code:

private static MyComDll connectionKit = new MyComDll();

public static void CreateBatch(obj ect hBatch)
{ ...
connectionKit.C omCreateBatch(. ..)
}

public static void SendBatch(objec t hBatch)
{ ...
connectionKit.S endBatch(...)
}

I have no problem with my application, however i think the performance
could
be better. Is there any better way to call methods in a com dll? I don't
have
access to sourcecode for the dll-file.

Nov 16 '05 #2
I was wondering if a could get better performance if i wrote my own wrapper.
I have seen examples using DllImport(), but I'm uncertain what to use. What
do you mean with COM interop requires a good number of operations for each
call?

Thanks in advance,
Jesper Nilsson
"Nicholas Paldino [.NET/C# MVP]" wrote:
Jesper,

What do you mean call methods in a COM dll? You are calling methods on
an object that is a wrapper to the type in a COM server. That's about as
good as you are going to be able to get, since COM interop requires a good
number of operations for each call (I think the average is somewhere around
40).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jesper Nilsson" <Je***********@ discussions.mic rosoft.com> wrote in message
news:D1******** *************** ***********@mic rosoft.com...
Hi,

I have imported my com dll with Visual studios "Add reference", and then
i'm
using this code:

private static MyComDll connectionKit = new MyComDll();

public static void CreateBatch(obj ect hBatch)
{ ...
connectionKit.C omCreateBatch(. ..)
}

public static void SendBatch(objec t hBatch)
{ ...
connectionKit.S endBatch(...)
}

I have no problem with my application, however i think the performance
could
be better. Is there any better way to call methods in a com dll? I don't
have
access to sourcecode for the dll-file.


Nov 16 '05 #3
Not sure what kind of application you are building, but you must make sure
your COM object is created in a compatible apartment, else you'll waste some
CPU cycles for cross thread/apartment marshaling.

Willy.
"Jesper Nilsson" <Je***********@ discussions.mic rosoft.com> wrote in message
news:D1******** *************** ***********@mic rosoft.com...
Hi,

I have imported my com dll with Visual studios "Add reference", and then
i'm
using this code:

private static MyComDll connectionKit = new MyComDll();

public static void CreateBatch(obj ect hBatch)
{ ...
connectionKit.C omCreateBatch(. ..)
}

public static void SendBatch(objec t hBatch)
{ ...
connectionKit.S endBatch(...)
}

I have no problem with my application, however i think the performance
could
be better. Is there any better way to call methods in a com dll? I don't
have
access to sourcecode for the dll-file.

Nov 16 '05 #4
Jesper,

When the runtime makes the call from the wrapper to your COM object, it
has to run a number of operations to make that call on the native COM
object. The 40 operations I quoted was the number between the call you see
in .NET and the call being made to your COM object.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jesper Nilsson" <Je***********@ discussions.mic rosoft.com> wrote in message
news:D7******** *************** ***********@mic rosoft.com...
I was wondering if a could get better performance if i wrote my own
wrapper.
I have seen examples using DllImport(), but I'm uncertain what to use.
What
do you mean with COM interop requires a good number of operations for each
call?

Thanks in advance,
Jesper Nilsson
"Nicholas Paldino [.NET/C# MVP]" wrote:
Jesper,

What do you mean call methods in a COM dll? You are calling methods
on
an object that is a wrapper to the type in a COM server. That's about as
good as you are going to be able to get, since COM interop requires a
good
number of operations for each call (I think the average is somewhere
around
40).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jesper Nilsson" <Je***********@ discussions.mic rosoft.com> wrote in
message
news:D1******** *************** ***********@mic rosoft.com...
> Hi,
>
> I have imported my com dll with Visual studios "Add reference", and
> then
> i'm
> using this code:
>
> private static MyComDll connectionKit = new MyComDll();
>
> public static void CreateBatch(obj ect hBatch)
> { ...
> connectionKit.C omCreateBatch(. ..)
> }
>
> public static void SendBatch(objec t hBatch)
> { ...
> connectionKit.S endBatch(...)
> }
>
> I have no problem with my application, however i think the performance
> could
> be better. Is there any better way to call methods in a com dll? I
> don't
> have
> access to sourcecode for the dll-file.


Nov 16 '05 #5

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

Similar topics

25
3479
by: Brian Patterson | last post by:
I have noticed in the book of words that hasattr works by calling getattr and raising an exception if no such attribute exists. If I need the value in any case, am I better off using getattr within a try statement myself, or is there some clever implementation enhancement which makes this a bad idea? i.e. should I prefer: if hasattr(self,"datum"): datum=getattr("datum") else: datum=None
12
17296
by: Fred | last post by:
Has anyone a link or any information comparing c and c++ as far as execution speed is concerned? Signal Processing algorithms would be welcome... Thanks Fred
12
8348
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 will work on preparing SQL statements that will create the tables, insert sample record and run the SP. I would hope people will look at my SP and give me any hints on how I can better write the SP.
4
3132
by: zzfreddybb | last post by:
We are using HP aCC compiler on a HP Itanium box ( 11.23) We are having some severe performance hits using exception handling ( try/catch ) scenarios. The online aCC documentation says: HP aC++ exception handling has no significant performance impact at compile-time or run-time. We have not found this to be the case at all.
5
4000
by: Scott | last post by:
I have a customer that had developed an Access97 application to track their business information. The application grew significantly and they used the Upsizing Wizard to move the tables to SQL 2000. Of course there were no modifications made to the queries and they noticed significant performance issues. They recently upgraded the application to Access XP expecting the newer version to provide performance benefits and now queries take...
4
3360
by: Martin | last post by:
I am using graphics as backgrounds for forms,buttons,labels etc. The question is: is it faster to load all graphics from files on app start or to use it embeded (places in editor during design). Reason for my question is that application has 5mb, while without graphics it has cca 400kb. Graphic files (bmps) take about 200kb (in program, they are repeated many times, ie almost all labels (around 200) have same background image)). Also,...
13
2757
by: bjarne | last post by:
Willy Denoyette wrote; > ... it > was not the intention of StrousTrup to the achieve the level of efficiency > of C when he invented C++, ... Ahmmm. It was my aim to match the performance of C and I achieved that aim very early on. See, for example "The Design and Evolution of C++". -- Bjarne Stroustrup; http://www.research.att.com/~bs
1
2447
by: jvn | last post by:
I am experiencing a particular problem with performance counters. I have created a set of classes, that uses System.Diagnostics.PerformanceCounter to increment custom performance counters (using .Net 2.0) The performance counter categories have been successfully created. When the set of classes are used by a WinForm test harness application, they function as expected, and the performance counters can be seen to be updated by using the...
13
4595
by: atlaste | last post by:
Hi, I'm currently developing an application that uses a lot of computational power, disk access and memory caching (to be more exact: an information retrieval platform). In these kind of applications the last thing that remains is bare performance tuning. So for example, you can do an 'if then else' on a bit like a 'case/ switch', an 'if/then/else' and as a multiplication with a static buffer. Or, you can do sorting with an inline...
0
8678
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2007
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.