speed difference between vbscript and vb com object???? 
Author Message
 speed difference between vbscript and vb com object????

I have always been told that in active server pages applications, you will
get better performance if you move processing out of asp and into a com
object.  I decided to test this with a simple loop to see the actual time
differences.  Basically, I created 2 simple asp pages.  One that does a loop
and spits out a hugh string, all being processed in the asp file.  The
second asp file actually calls a dll with the creatobject syntax, and the
dll does the same thing, then returns it to the asp page.  I AM VERY
PUZZELED BY THE RESULTS!!!!  They both run in almost identical time, about
40 seconds on my celeron 400..(well, with seti running of course!)

Quote:
Heres what I wrote...

IN ASP...

Response.buffer=true
Dim I
Do while I<25000
    Response.Write "Blah Blah Blah Blah"
    I=I+1
Loop

Then, I created a VB6 activex dll.  I set a reference to the asp objects,
and wrote the following class...

Dim objResp as ASPTypeLib.Response
Public Sub Looper(p_objResp as ASPTypeLib.Response)
    set objResp=p_objResp

    objResp.Buffer=true
    dim I as integer
    do while I<25000
        Response.Write "Blah Blah Blah Blah"
        I=I+1
    loop
End sub

The asp page to go with this dll looks like this...

Set obj=Server.CreateObject("TestDll.Looper")
obj.looper(Response)

Thats it?????

Can anyone explain to me why there is virtually no speed difference between
these two approaches in process??

Thanks in advance!!

To reply to me, remove the x's in my email address!



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????

Darin,

     Having read the code, I'm not in the least bit surprised you're
     getting the same results!  Both programs are doing exactly the same
     job, using exactly the same Objects and Methods so, if anything, I'd
     expect the overhead of creating the ActiveX Dll to actually make that
     implementation slower.
     Try something that plays a little more to VB's strengths - like chunky
     arithmetic calculations or hefty, internal, string handling - then
     dump the entire result back out to the ASP environment.  You should
     then [he says, hopefully] see some improvements.  After all, ASP is
     just an Object Model and can, as you have most successfully proven, be
     manipulated by any Object-capable language.

HTH,
    Phill  W.

Quote:

> Can anyone explain to me why there is virtually no speed difference between
> these two approaches in process??



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????
I know that I am not a guru, but surely a For...Loop doesn't really give much of

a performance impact.  Try some sort of sorting test (quick, bubble, etc..) with

a vast amount of elements.  I bet you'll find a difference then.

Alan.

Quote:

> I have always been told that in active server pages applications, you will
> get better performance if you move processing out of asp and into a com
> object.  I decided to test this with a simple loop to see the actual time
> differences.  Basically, I created 2 simple asp pages.  One that does a loop
> and spits out a hugh string, all being processed in the asp file.  The
> second asp file actually calls a dll with the creatobject syntax, and the
> dll does the same thing, then returns it to the asp page.  I AM VERY
> PUZZELED BY THE RESULTS!!!!  They both run in almost identical time, about
> 40 seconds on my celeron 400..(well, with seti running of course!)

> Heres what I wrote...

> IN ASP...

> Response.buffer=true
> Dim I
> Do while I<25000
>     Response.Write "Blah Blah Blah Blah"
>     I=I+1
> Loop

> Then, I created a VB6 activex dll.  I set a reference to the asp objects,
> and wrote the following class...

> Dim objResp as ASPTypeLib.Response
> Public Sub Looper(p_objResp as ASPTypeLib.Response)
>     set objResp=p_objResp

>     objResp.Buffer=true
>     dim I as integer
>     do while I<25000
>         Response.Write "Blah Blah Blah Blah"
>         I=I+1
>     loop
> End sub

> The asp page to go with this dll looks like this...

> Set obj=Server.CreateObject("TestDll.Looper")
> obj.looper(Response)

> Thats it?????

> Can anyone explain to me why there is virtually no speed difference between
> these two approaches in process??

> Thanks in advance!!

> To reply to me, remove the x's in my email address!



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????
Hi there,
Setting an ASP reference to a dll that is creating an object with
CREATEOBJECT
ie late-bound is exactly how VBA VB Script deals with everything, because
the
compiler does not know what object to create until run time, so how can
there
be any speed difference in your test.
The moment you use any VBA VB Script variant objects as above you throw away
any speed advantage that early binding by setting a Reference could bring.
You would need to early-bind your specific object in the ASP by setting the
references to your dll then create your known object as in the following AIR
CODE
VB Reference          Speedy.dll
Public myObj as Speedy
Sub..........
Set myObj as New Speedy
This also bring the advantage of typechecking of your methods and properties
within your code at design time. Instead of falling over at run time.
Then compare the speed, the difference should convince you to use early
binding when possible

Hope this helps


Quote:
> I have always been told that in active server pages applications, you will
> get better performance if you move processing out of asp and into a com
> object.  I decided to test this with a simple loop to see the actual time
> differences.  Basically, I created 2 simple asp pages.  One that does a
loop
> and spits out a hugh string, all being processed in the asp file.  The
> second asp file actually calls a dll with the creatobject syntax, and the
> dll does the same thing, then returns it to the asp page.  I AM VERY
> PUZZELED BY THE RESULTS!!!!  They both run in almost identical time, about
> 40 seconds on my celeron 400..(well, with seti running of course!)

> Heres what I wrote...

> IN ASP...

> Response.buffer=true
> Dim I
> Do while I<25000
>     Response.Write "Blah Blah Blah Blah"
>     I=I+1
> Loop

> Then, I created a VB6 activex dll.  I set a reference to the asp objects,
> and wrote the following class...

> Dim objResp as ASPTypeLib.Response
> Public Sub Looper(p_objResp as ASPTypeLib.Response)
>     set objResp=p_objResp

>     objResp.Buffer=true
>     dim I as integer
>     do while I<25000
>         Response.Write "Blah Blah Blah Blah"
>         I=I+1
>     loop
> End sub

> The asp page to go with this dll looks like this...

> Set obj=Server.CreateObject("TestDll.Looper")
> obj.looper(Response)

> Thats it?????

> Can anyone explain to me why there is virtually no speed difference
between
> these two approaches in process??

> Thanks in advance!!

> To reply to me, remove the x's in my email address!



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????
This is because Response.Write takes most of the procesor time. Try the next
code :
 dim HTML as string , I as long
 Do while I<25000
     HTML = HTML + "BB"
     I=I+1
 Loop
in ASP and VB. The VB code will be 5 times faster (VB has typed variables,
ASP only variants).

or try
 Do while I<25000
     HTML = request.querystring("BB")
     I=I+1
 Loop
VB is 10 times faster than VBS.

Antonin Foller
PSTRUH Software
http://www.pstruh.cz


Quote:
> I have always been told that in active server pages applications, you will
> get better performance if you move processing out of asp and into a com
> object.  I decided to test this with a simple loop to see the actual time
> differences.  Basically, I created 2 simple asp pages.  One that does a
loop
> and spits out a hugh string, all being processed in the asp file.  The
> second asp file actually calls a dll with the creatobject syntax, and the
> dll does the same thing, then returns it to the asp page.  I AM VERY
> PUZZELED BY THE RESULTS!!!!  They both run in almost identical time, about
> 40 seconds on my celeron 400..(well, with seti running of course!)

> Heres what I wrote...

> IN ASP...

> Response.buffer=true
> Dim I
> Do while I<25000
>     Response.Write "Blah Blah Blah Blah"
>     I=I+1
> Loop

> Then, I created a VB6 activex dll.  I set a reference to the asp objects,
> and wrote the following class...

> Dim objResp as ASPTypeLib.Response
> Public Sub Looper(p_objResp as ASPTypeLib.Response)
>     set objResp=p_objResp

>     objResp.Buffer=true
>     dim I as integer
>     do while I<25000
>         Response.Write "Blah Blah Blah Blah"
>         I=I+1
>     loop
> End sub

> The asp page to go with this dll looks like this...

> Set obj=Server.CreateObject("TestDll.Looper")
> obj.looper(Response)

> Thats it?????

> Can anyone explain to me why there is virtually no speed difference
between
> these two approaches in process??

> Thanks in advance!!

> To reply to me, remove the x's in my email address!



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????
If I understand correctly, you can not do what you are saying from within
ASP.  You can only create an object in asp by either the <object> tag, or
the create object method, both of which are late bound.

Inside the DLL, the only way to actually have context to the asp objects is
to pass an asp object by reference and set it to the locally dimmed object?
I think?


Quote:
> Hi there,
> Setting an ASP reference to a dll that is creating an object with
> CREATEOBJECT
> ie late-bound is exactly how VBA VB Script deals with everything, because
> the
> compiler does not know what object to create until run time, so how can
> there
> be any speed difference in your test.
> The moment you use any VBA VB Script variant objects as above you throw
away
> any speed advantage that early binding by setting a Reference could bring.
> You would need to early-bind your specific object in the ASP by setting
the
> references to your dll then create your known object as in the following
AIR
> CODE
> VB Reference          Speedy.dll
> Public myObj as Speedy
> Sub..........
> Set myObj as New Speedy
> This also bring the advantage of typechecking of your methods and
properties
> within your code at design time. Instead of falling over at run time.
> Then compare the speed, the difference should convince you to use early
> binding when possible

> Hope this helps



> > I have always been told that in active server pages applications, you
will
> > get better performance if you move processing out of asp and into a com
> > object.  I decided to test this with a simple loop to see the actual
time
> > differences.  Basically, I created 2 simple asp pages.  One that does a
> loop
> > and spits out a hugh string, all being processed in the asp file.  The
> > second asp file actually calls a dll with the creatobject syntax, and
the
> > dll does the same thing, then returns it to the asp page.  I AM VERY
> > PUZZELED BY THE RESULTS!!!!  They both run in almost identical time,
about
> > 40 seconds on my celeron 400..(well, with seti running of course!)

> > Heres what I wrote...

> > IN ASP...

> > Response.buffer=true
> > Dim I
> > Do while I<25000
> >     Response.Write "Blah Blah Blah Blah"
> >     I=I+1
> > Loop

> > Then, I created a VB6 activex dll.  I set a reference to the asp
objects,
> > and wrote the following class...

> > Dim objResp as ASPTypeLib.Response
> > Public Sub Looper(p_objResp as ASPTypeLib.Response)
> >     set objResp=p_objResp

> >     objResp.Buffer=true
> >     dim I as integer
> >     do while I<25000
> >         Response.Write "Blah Blah Blah Blah"
> >         I=I+1
> >     loop
> > End sub

> > The asp page to go with this dll looks like this...

> > Set obj=Server.CreateObject("TestDll.Looper")
> > obj.looper(Response)

> > Thats it?????

> > Can anyone explain to me why there is virtually no speed difference
> between
> > these two approaches in process??

> > Thanks in advance!!

> > To reply to me, remove the x's in my email address!



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????
I tried that, it took twice as long!!!

Try it yourself.  By building up the string first, then placing it in the
response buffer, your doing twice the work.


Quote:
> This is because Response.Write takes most of the procesor time. Try the
next
> code :
>  dim HTML as string , I as long
>  Do while I<25000
>      HTML = HTML + "BB"
>      I=I+1
>  Loop
> in ASP and VB. The VB code will be 5 times faster (VB has typed variables,
> ASP only variants).

> or try
>  Do while I<25000
>      HTML = request.querystring("BB")
>      I=I+1
>  Loop
> VB is 10 times faster than VBS.

> Antonin Foller
> PSTRUH Software
> http://www.pstruh.cz



> > I have always been told that in active server pages applications, you
will
> > get better performance if you move processing out of asp and into a com
> > object.  I decided to test this with a simple loop to see the actual
time
> > differences.  Basically, I created 2 simple asp pages.  One that does a
> loop
> > and spits out a hugh string, all being processed in the asp file.  The
> > second asp file actually calls a dll with the creatobject syntax, and
the
> > dll does the same thing, then returns it to the asp page.  I AM VERY
> > PUZZELED BY THE RESULTS!!!!  They both run in almost identical time,
about
> > 40 seconds on my celeron 400..(well, with seti running of course!)

> > Heres what I wrote...

> > IN ASP...

> > Response.buffer=true
> > Dim I
> > Do while I<25000
> >     Response.Write "Blah Blah Blah Blah"
> >     I=I+1
> > Loop

> > Then, I created a VB6 activex dll.  I set a reference to the asp
objects,
> > and wrote the following class...

> > Dim objResp as ASPTypeLib.Response
> > Public Sub Looper(p_objResp as ASPTypeLib.Response)
> >     set objResp=p_objResp

> >     objResp.Buffer=true
> >     dim I as integer
> >     do while I<25000
> >         Response.Write "Blah Blah Blah Blah"
> >         I=I+1
> >     loop
> > End sub

> > The asp page to go with this dll looks like this...

> > Set obj=Server.CreateObject("TestDll.Looper")
> > obj.looper(Response)

> > Thats it?????

> > Can anyone explain to me why there is virtually no speed difference
> between
> > these two approaches in process??

> > Thanks in advance!!

> > To reply to me, remove the x's in my email address!



Sat, 02 Mar 2002 03:00:00 GMT  
 speed difference between vbscript and vb com object????

Yeah, they are doing the exact same thing.  This is what I though is the best way to compare compiled vs non compiled execution.

I tried to build up one big string in the dll, then dump it to the repsonse object, took twice as long, and that makes sense because it has to first build up the huge string, then dump a lot of text to the reponse buffer....twice the work.

  Darin,
    Having read the code, I'm not in the least bit surprised you're getting the same results!  Both programs are doing exactly the same job, using exactly the same Objects and Methods so, if anything, I'd expect the overhead of creating the ActiveX Dll to actually make that implementation slower.
    Try something that plays a little more to VB's strengths - like chunky arithmetic calculations or hefty, internal, string handling - then dump the entire result back out to the ASP environment.  You should then [he says, hopefully] see some improvements.  After all, ASP is just an Object Model and can, as you have most successfully proven, be manipulated by any Object-capable language.
  HTH,
      Phill  W.

    Can anyone explain to me why there is virtually no speed difference between these two approaches in process??



Sat, 02 Mar 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. speed difference between vbscript and vb com object????

2. REQ:: Speed Difference in COM servers ???!

3. Call VB DLL or COM object from within VB COM object or EXE

4. Empty Arrary when VBScript calls VB COM object.

5. Creating VB COM object to access Jscript from VBScript

6. com object will not read registry when com object called from asp (vb works fine)

7. VB Com Object Using Implements Fails In VBScript

8. Visio.Application (COM object) Speed

9. VB6 to VB.NET - any speed difference?

10. COM-Object in ASP with COM-Object as parameter

11. COM-Object in ASP with COM-Object as Parameter

12. VBScript calling to a COM object that expects a user-defined object

 

 
Powered by phpBB® Forum Software