First Call to DLL is slow 
Author Message
 First Call to DLL is slow

Hello all,

     I have written a COM object using ATL.  It has a method that gets
an XML string, parses it, calculates, and outputs a result XML string.
 I have been trying to measure the time that the object takes to
generate the string, and I have noticed that the first time the
program is run, the method takes .3-.4 seconds longer than if it is
run the second or third time.  The project is in a DLL and I'm calling
it from Visual Basic using the new keyword.  The DLL and the client
app are on the same machine.  I have been timing it from just after
creating the object (using the New keyword) and just before destroying
the object.  Any ideas on what could be causing this time increase,
and how I could go about reducing it?

Thanks in advance,

Nimish



Sat, 11 Sep 2004 05:11:36 GMT  
 First Call to DLL is slow
Are you using anything in your ATL component to parse the XML like
Microsoft's parser?  I imagine that would slow things down a bit.

-Chris


Quote:
> Hello all,

>      I have written a COM object using ATL.  It has a method that gets
> an XML string, parses it, calculates, and outputs a result XML string.
>  I have been trying to measure the time that the object takes to
> generate the string, and I have noticed that the first time the
> program is run, the method takes .3-.4 seconds longer than if it is
> run the second or third time.  The project is in a DLL and I'm calling
> it from Visual Basic using the new keyword.  The DLL and the client
> app are on the same machine.  I have been timing it from just after
> creating the object (using the New keyword) and just before destroying
> the object.  Any ideas on what could be causing this time increase,
> and how I could go about reducing it?

> Thanks in advance,

> Nimish



Sat, 11 Sep 2004 05:11:30 GMT  
 First Call to DLL is slow
One step you may take to reduce somewhat the initial loading overhead
is to change your DLLs load address. The default value of 0x1000000 is
about guaranteed to encounter collisions and costly relocation. Although
no address is guaranteed to not cause relocation, your chances would be
much better... (You can also investigate what addresses all DLLs are loaded
at and make a more informed decision for this particular scenario.)

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> Hello all,

>      I have written a COM object using ATL.  It has a method that gets
> an XML string, parses it, calculates, and outputs a result XML string.
>  I have been trying to measure the time that the object takes to
> generate the string, and I have noticed that the first time the
> program is run, the method takes .3-.4 seconds longer than if it is
> run the second or third time.  The project is in a DLL and I'm calling
> it from Visual Basic using the new keyword.  The DLL and the client
> app are on the same machine.  I have been timing it from just after
> creating the object (using the New keyword) and just before destroying
> the object.  Any ideas on what could be causing this time increase,
> and how I could go about reducing it?

> Thanks in advance,

> Nimish



Sat, 11 Sep 2004 09:34:51 GMT  
 First Call to DLL is slow
Look at the rebase tool and link option to help you with the task of
changing the default load address:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnma...
l/hood0500.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tool...
til_2z39.asp

http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0498/bugslaye...
tm&nav=/msj/0498/newnav.htm

Dirk


One step you may take to reduce somewhat the initial loading overhead
is to change your DLLs load address. The default value of 0x1000000 is
about guaranteed to encounter collisions and costly relocation. Although
no address is guaranteed to not cause relocation, your chances would be
much better... (You can also investigate what addresses all DLLs are loaded
at and make a more informed decision for this particular scenario.)

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> Hello all,

>      I have written a COM object using ATL.  It has a method that gets
> an XML string, parses it, calculates, and outputs a result XML string.
>  I have been trying to measure the time that the object takes to
> generate the string, and I have noticed that the first time the
> program is run, the method takes .3-.4 seconds longer than if it is
> run the second or third time.  The project is in a DLL and I'm calling
> it from Visual Basic using the new keyword.  The DLL and the client
> app are on the same machine.  I have been timing it from just after
> creating the object (using the New keyword) and just before destroying
> the object.  Any ideas on what could be causing this time increase,
> and how I could go about reducing it?

> Thanks in advance,

> Nimish



Sun, 12 Sep 2004 01:57:16 GMT  
 First Call to DLL is slow
Thanks, I used rebase to find the load addresses, and after I changed
them, the load time was .1-.2 seconds faster.  Thanks for all of your
help.

-Nimish

Quote:

> Look at the rebase tool and link option to help you with the task of
> changing the default load address:

> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnma...
> l/hood0500.asp

> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tool...
> til_2z39.asp

> http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0498/bugslaye...
> tm&nav=/msj/0498/newnav.htm

> Dirk



> One step you may take to reduce somewhat the initial loading overhead
> is to change your DLLs load address. The default value of 0x1000000 is
> about guaranteed to encounter collisions and costly relocation. Although
> no address is guaranteed to not cause relocation, your chances would be
> much better... (You can also investigate what addresses all DLLs are loaded
> at and make a more informed decision for this particular scenario.)

> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD

> MVP VC FAQ: http://www.mvps.org/vcfaq
> =====================================



> > Hello all,

> >      I have written a COM object using ATL.  It has a method that gets
> > an XML string, parses it, calculates, and outputs a result XML string.
> >  I have been trying to measure the time that the object takes to
> > generate the string, and I have noticed that the first time the
> > program is run, the method takes .3-.4 seconds longer than if it is
> > run the second or third time.  The project is in a DLL and I'm calling
> > it from Visual Basic using the new keyword.  The DLL and the client
> > app are on the same machine.  I have been timing it from just after
> > creating the object (using the New keyword) and just before destroying
> > the object.  Any ideas on what could be causing this time increase,
> > and how I could go about reducing it?

> > Thanks in advance,

> > Nimish



Sun, 12 Sep 2004 06:17:39 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VC++ 6.0 SLOW SLOW SLOW SLOW SLOW SLOW

2. Help: First dll for VB calling, .def file problems

3. Calling a function in my first instance of my DLL

4. Sockets really slow, am i missing something ?

5. Slow Update at first

6. Problem calling into managed DLL that calls unmanaged DLL

7. VC6 DLL calls VB6 DLL calls back to VC6 DLL: Occasional GPF or ‘Bad DLL calling convention'

8. I am seachcing a free pascal editor if someone known a web site just called me

9. ending a blocing sockets call (am using MFC's CSocket class)

10. Calling conventions: __fastcall slower than __cdecl (MS VC++)

11. calling Free is VERY SLOW under Windows 2000

12. Calling conventions: __fastcall slower than __cdecl

 

 
Powered by phpBB® Forum Software