Re: registration order of tlb, proxy/stub, exe
khalprin <khalprin@discussions.microsoft.com> wrote:
I have a win32 process that is a COM server. It has a proxy/stub dll
and also imports interface defintions from a type library. I have a
test client application which uses some of the interfaces to retrieve
configuration data from the COM server. The test consists of a loop
which retrieves the configuration data a few thousand times. The
order in which I register the server executable, proxy/stub dll, and
type library hugely affects the time in which the client can complete
the test loops. In some scenarios, the test can complete in 3
seconds. In other scenarios, the test completes in 90 seconds. I've
run this test after each combination of the order in which I can
register the three. It appears that when the server executable is
registered before the type library, the result is the 3 second test
time. When the server executable is registered after the type
library, the result is the 90 second test time.
My guess is, it has nothing to do with the executable itself. What
matters is whether the type library or the proxy/stub DLL are registered
last: whichever is registered last becomes the means by which interface
calls are marshalled. Proxy/stub DLL is machine code generated and
compiled to support a specific interface. Type library is just a
description of the interface, interpreted at run time by universal
marshaller.
Apparently, your COM server does very little actual work, and the time
of the call is dominated by marshalling overhead. Proxy/stub DLL is more
efficient for that.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925