I could be wrong about this, but my understanding is that strings are
immutable in JavaScript. Every time you append to a string what's
actually happening is that a new string object is being created with
its contents set to be the first string plus the second string,
whereas the original string
huh. this is an interesting thought. why would the use of join() speed
things up versus just appending a string variable?
the reason I'm not concerned about the for() loop is that it seems to
be quite fast when I output the strHTML in a document.write.
I'm trying to figure out wasy to speed up
Did you try the wrapper DIV that I suggested? Did it help or not?
$('div.displayer').html( 'div' + strHTML + '/div' );
-Mike
huh. this is an interesting thought. why would the use of
join() speed things up versus just appending a string variable?
the reason I'm not concerned about the
Your original post doesn't mention what your code looks like. Were you
calling .append() on each row individually?
Instead, build up a single string and call .html() once to load the string
into a container element. That should be just about as fast as
document.write, if you build the string
posting all code would be crazy but here is relevant snippets.
First the loop I use to iterate ofer an array and write some stuff
into a bunch of DIV elements.
I then want that tho show up someplace on my page. iframe and
document.write displays 500 items basically instantly.
the html() to div
Try wrapping strHTML in one single wrapper DIV before you insert it into the
DOM. I'll bet it will go a lot faster:
$('div.displayer').html( 'div' + strHTML + '/div' );
How's the timing on the for loop? Any browsers where it takes any
significant time? You may speed it up in some browsers
6 matches
Mail list logo