Richard, thanks for all the ideas. It turns out, though, (after more
testing) that the
problem is neither sort speed nor memory. Even when I have about 1000
records, sort() itself takes only about two seconds. The ridiculous time
lag occurs
when I write them out to a table for display, which takes about 15 seconds.
Rendering the table
takes only about 2-3 seconds, but simply creating the text to be rendered is
for
some strange reason very slow. I can't see any way around it. Can you?
Here is the offending loop:
for (var i in this.records) {
txt += '<tr>'
for (var j in this.records[i])
txt += '<td>' + this.records[i][j] + '</td>'
txt += '</tr>'
}
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Richard
Bennett
Sent: Friday, July 13, 2001 3:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [Dynapi-Help] one more question
I think the first thing to do is find out what's eating all the memory, try
loading up the array, without writing the contents, measure the memory use,
and compare to a light page.
If it's not so bad, I would suggest leaving the table out, and trying to use
as little html tags as possible to render the contents. using <span> tags
gets more or less the same effect as a table, if you add a stylesheet. I
found nested tables to be real memory eaters. Also avoid nesting divs and
spans.
The <a href> tag can also be useful, as using CSS it can look like a button,
while degrading nicely in NS4, it uses a lot less memory than a dhtml
button.
If the array by itself doesn't use too much memory, you could copy the array
once or twice, and sort the copies as needed, before they are called, once a
user selects to sort the table, they don't have to wait for the array to
sort, as it already did, if you know what I mean.
Also, the sorting only happens once, so if they click between columns the
action should be fast.
just a few ideas...
Cheers,
Richard Bennett
[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to DynAPI2.53)
visit the DynAPI homepage (and FAQ) ::
http://dynapi.sourceforge.net/dynapi/index.php?menu=1
Browse (and search) the mailinglist here:
http://www.mail-archive.com/index.php3?hunt=dynapi
----- Original Message -----
From: "Jonah" <[EMAIL PROTECTED]>
To: "Dynapi-Help" <[EMAIL PROTECTED]>
Sent: 13 July, 2001 22:29
Subject: [Dynapi-Help] one more question
> I'm having another, somewhat related problem, which seems due to
JavaScript
> memory constraints. I initialize a large number of JavaScript arrays (the
> problem seems to start at about 1000) and then loop through them and
display
> them in a table, which I write to the page using setHTML() on a DynLayer.
> This crashes IE 5.5. Does anyone know what the problem is and if there is
a
> way to fix it?
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help