Slow Jscript objects response with large number of objects

26 views
Skip to first unread message

Arvind

unread,
Mar 14, 2005, 8:15:04 AM3/14/05
to
I 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 issue lies with Jscript Script engine itself and not specific to IE.

I will appreciate a quick response on this, and any workarounds or patches
to go around this issue will be highly appreciated

Thanks,
Arvind


Sean

unread,
Apr 14, 2005, 5:07:02 PM4/14/05
to
Hey Arvind:

Yes. . .I have noticed this is the case as well. My guess it that there are
most likely signficant differences between the JScript engine that IE 6 uses
and the Javascript engine that both Mozilla and Netscape use.

Hopefully, MS (HOPE YOUR LOOKING AT THIS), will update the Scripting engine
as there are other performance issues as well and of course its not updated
with the 1.5 spec completely (such as getters/setters, __proto__ access),
etc. Specifically, string processing is much much faster in Moz JS rather
than IE.

Your code doesn't look to horid. . . just normal native JS stuff.
But I can tell you that i have been building rich client apps with embedded
IE controls that use TONS AND TONS of JS for years and have always been able
to get satisfactory performance. (and these are very peformance saavy apps
like games and media player). I would worry too much. . .

Reply all
Reply to author
Forward
0 new messages