Slow Jscript objects response with large number of objects

Slow Jscript objects response with large number of objects

Post by QXJ2aW5 » Tue, 15 Mar 2005 20:11:05


am experiencing slow response by Jscript object access and creation
functions when large numbers of custom objects are created on a page. Same
code in Firefox and Netscape works fine and there is no slowness in creation
of execution of objects. Attached is a simple html page with javascript
(http://www.geocities.com/arvindsagarwal/test.htm) to demostrate that (htm
file contains inline javascript).

Results which i got in IE 6 with XP SP2 with all latest patches and latest
version 5.6 of scripting host installed, (Similar behaviour noticed on
different machines with Windows Server or Windows XP OS)
1) Create 10000 Objects took 220ms
2) Create 10000 Objects Second Time took 210ms

3) Making Collection of 10000 objects took 742ms

4) Create 10000 Objects after creation of collection took 711ms
5) Create 10000 Objects second time after creation of collection took 701ms

6) Creating 10000 objects after destroying the collection took 250ms
7) Creating 10000 objects second time after destroying the collection took
210ms

In the above results, 1 & 2 are time it took to create 10000 objects, these
objects were not added to any collection and destroyed immediately upon
creation.
Now in 3 again the 10000 objects got created but this time they are added to
a collection
Now in 4 & 5 same code as 1 & 2 which took around 200ms now takes 700 ms to
create the objects. - This is the problem.
Now if we destroy the collection and execute the same object creation code
as 1 & 2 it again goes back to normal performance as 1 & 2.

Hence there seems to be some problem when large number of objects exists in
the memory and Jscript is incremently getting slowed down as a result all
dynamic operations on the page appers to be very slow. We are developing a
rich client side application on browser and this is causing some unacceptable
delayes in loading and accessing the information on the page.

I also tried to run the above page on Mozilla Firefox 1.0 browser installed
in the same machine, here are the results
1) Create 10000 Objects took 60ms
2) Create 10000 Objects Second Time took 70ms

3) Making Collection of 10000 objects took 110ms

4) Create 10000 Objects after creation of collection took 60ms
5) Create 10000 Objects second time after creation of collection took 80ms

6) Creating 10000 objects after destroying the collection took 90ms
7) Creating 10000 objects second time after destroying the collection took
50ms

If you notice there is no delay in object creation here and objects are
created much much faster.

Results on Netscape 7.2 Installed on the same machine.

1) Create 10000 Objects took 160ms
2) Create 10000 Objects Second Time took 140ms

3) Making Collection of 10000 objects took 201ms

4) Create 10000 Objects after creation of collection took 140ms
5) Create 10000 Objects second time after creation of collection took 160ms

6) Creating 10000 objects after destroying the collection took 180ms
7) Creating 10000 objects second time after destroying the collection took
141ms

again, if you notice above no additional delay is introduced while creating
or accessing objects event with large number of objects in the memory.

---------------------------
I have also done the similar test using a js
(http://www.geocities.com/arvindsagarwal/test.js) file, which can be executed
using WSH and it shows exactly the same results, this makes be believe that
the
 
 
 

Slow Jscript objects response with large number of objects

Post by Jeff Nort » Tue, 15 Mar 2005 23:22:16

On Mon, 14 Mar 2005 03:11:05 -0800, in
microsoft.public.scripting.jscript Arvind


[snip]

Since all this is going on client-side then the speed and memory of
their computer is going to have a large impact on your code.

My machine, P4 3.2 512Ram. The results:
IE 6
1) Create 10000 Objects took 125ms
2) Create 10000 Objects Second Time took 140ms

3) Making Collection of 10000 objects took 438ms

4) Create 10000 Objects after creation of collection took 469ms
5) Create 10000 Objects second time after creation of collection took
484ms

6) Creating 10000 objects after destroying the collection took 172ms
7) Creating 10000 objects second time after destroying the collection
took 110ms


FireFox
1) Create 10000 Objects took 31ms
2) Create 10000 Objects Second Time took 31ms

3) Making Collection of 10000 objects took 78ms

4) Create 10000 Objects after creation of collection took 31ms
5) Create 10000 Objects second time after creation of collection took
47ms

6) Creating 10000 objects after destroying the collection took 32ms
7) Creating 10000 objects second time after destroying the collection
took 62ms


---------------------------------------------------------------
XXXX@XXXXX.COM : Remove your pants to reply
---------------------------------------------------------------

 
 
 

Slow Jscript objects response with large number of objects

Post by QXJ2aW5 » Wed, 16 Mar 2005 01:43:17

i Jeff,
Thanks for the reply. My problem is not slow execution of the code on a
particular machine or fact that it is taking lesser time in firefox to create
a object then in ie. But the problem is that step 4 & 5 take almost 3x the
time of step 1 & 2 because in step 3 10,000 objects are created and retained
in the memory. And as the number of objects increase some how Jscript keeps
on taking more and more time to access any object this include creation as
well as accessing the object.

Now the reason i had give statsitics on Firefox and Netscape is that they
dont show any such behaviour and their figures in step 1 & 2 are similar to
step 4 & 5 that means creation of 10,000 objects in step 3 does not affect
them at all.

Because of this behaviour of Jscript in IE, moment i have many objects in my
web page subsquent calls to creation of object starts taking incremently more
time. And functionality which works absolutely well in Netscape and Firefox
timesout in IE.

I hope i have more clearly explained the problem.

Thanks
Arvind

"Jeff North" wrote:

 
 
 

Slow Jscript objects response with large number of objects

Post by Jeff Nort » Wed, 16 Mar 2005 10:00:17

On Mon, 14 Mar 2005 08:43:17 -0800, in
microsoft.public.scripting.jscript Arvind



Terminology correction: JScript is server-side coding used with ASP.
You are talking purely javascript (client-side code).

I'm only guessing here: I presume that the objects are placed in
linked lists/hash tables. Obviously IE doesn't handle these too well.

BTW, why are you requiring so many objects on a single page?
---------------------------------------------------------------
XXXX@XXXXX.COM : Remove your pants to reply
---------------------------------------------------------------
 
 
 

Slow Jscript objects response with large number of objects

Post by Randy Web » Wed, 16 Mar 2005 11:11:40


Within IE, the scripting is JScript and VBScript, both on the client and
on the server.

Or, does this page:

<URL:
http://www.yqcomputer.com/
>

Refer to server side coding?

--
Randy
comp.lang.javascript FAQ - http://www.yqcomputer.com/
 
 
 

Slow Jscript objects response with large number of objects

Post by QXJ2aW5 » Wed, 16 Mar 2005 11:35:01


Jscript is a scripting langauage, Microsofts implementetion of Netscapes
Javascript. And it can be used in IE (Client side) or in ASP pages server
side. One more thing which i have tried to point out in my post is that i did
this experiment on pure JScript .js file and run using WSH and still got the
same problem. So this means it has nothing to do with IE or the host of the
Jscript. This problem lies in Jscript internals itself.

I am not creating 10,000 objects on my page, but since object access also
gets slow even with say around 500 objects, the page starts becoming slow.
And bigger problem is the slowness also incremently increases as number of
objects increase.
The reason i chose to put 10,000 objects in the example was to show what is
the core problem. It took 3 days for me to figure out where the problem lies
since i always thought IE would be fastest with Javascript, but on contrary
my pages were working fine in Firefox and Netscape but having problem in IE.
 
 
 

Slow Jscript objects response with large number of objects

Post by Randy Web » Wed, 16 Mar 2005 11:42:03


My response wasn't with your test or your question, but the misguided
statement that "JScript is server-side coding used with ASP. While it is
true that server side with ASP is one use of JScript, it is by no means
its only use. And that is what the statement I replied to implied to me.



--
Randy
comp.lang.javascript FAQ - http://www.yqcomputer.com/
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
 
 
 

Slow Jscript objects response with large number of objects

Post by Jeff Nort » Wed, 16 Mar 2005 13:36:45

On Mon, 14 Mar 2005 21:11:40 -0500, in
microsoft.public.scripting.jscript Randy Webb < XXXX@XXXXX.COM >





http://www.yqcomputer.com/
.... JScript scripts can run only in the presence of an interpreter or
"host", such as Active Server Pages (ASP), Internet Explorer, or
Windows Script Host.


---------------------------------------------------------------
XXXX@XXXXX.COM : Remove your pants to reply
---------------------------------------------------------------
 
 
 

Slow Jscript objects response with large number of objects

Post by Randy Web » Thu, 17 Mar 2005 08:10:19


<--snip-->


Which was precisely my point. To state that "JScript is server-side
coding used with ASP" and that Javascript is client-side is *very*
misleading, all the way to the point of being plain wrong.

--
Randy
comp.lang.javascript FAQ - http://www.yqcomputer.com/
 
 
 

Slow Jscript objects response with large number of objects

Post by Jeff Nort » Thu, 17 Mar 2005 23:05:37

On Tue, 15 Mar 2005 18:10:19 -0500, in
microsoft.public.scripting.jscript Randy Webb < XXXX@XXXXX.COM >






What ever.
---------------------------------------------------------------
XXXX@XXXXX.COM : Remove your pants to reply
---------------------------------------------------------------
 
 
 

Slow Jscript objects response with large number of objects

Post by Nick Shray » Thu, 15 Sep 2005 16:16:38

I'm experiencing the same problem!!!!
Did you find any workaround/solution??

Help!!!!
Any response is appreciated

Nick Shrayer