473,407 Members | 2,320 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,407 software developers and data experts.

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(object hBatch)
{ ...
connectionKit.ComCreateBatch(...)
}

public static void SendBatch(object hBatch)
{ ...
connectionKit.SendBatch(...)
}

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 1184
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.com

"Jesper Nilsson" <Je***********@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.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(object hBatch)
{ ...
connectionKit.ComCreateBatch(...)
}

public static void SendBatch(object hBatch)
{ ...
connectionKit.SendBatch(...)
}

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.com

"Jesper Nilsson" <Je***********@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.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(object hBatch)
{ ...
connectionKit.ComCreateBatch(...)
}

public static void SendBatch(object hBatch)
{ ...
connectionKit.SendBatch(...)
}

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.microsoft.com> wrote in message
news:D1**********************************@microsof t.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(object hBatch)
{ ...
connectionKit.ComCreateBatch(...)
}

public static void SendBatch(object hBatch)
{ ...
connectionKit.SendBatch(...)
}

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.com

"Jesper Nilsson" <Je***********@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.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.com

"Jesper Nilsson" <Je***********@discussions.microsoft.com> wrote in
message
news:D1**********************************@microsof t.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(object hBatch)
> { ...
> connectionKit.ComCreateBatch(...)
> }
>
> public static void SendBatch(object hBatch)
> { ...
> connectionKit.SendBatch(...)
> }
>
> 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
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...
12
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
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...
4
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...
5
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...
4
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)....
13
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...
1
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...
13
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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...

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.