According to that test, array and join is almost 6 times as fast as string concat in my browser (Firefox on Vista).
On Feb 6, 4:37 pm, J Moore <[EMAIL PROTECTED]> wrote: > I've heard a few people mention the building an array and then > using .join(''). I found that good-old-fashioned string concatenation > was faster - and the syntax a bit cleaner. > > There's a neat test on this page. The joining arrays seems is a bit > slower for me. (Firefox on OS X) > > http://www.quirksmode.org/dom/innerhtml.html > > Is joining arrays (i.e. the "innerHTML 2 test") faster for you? > > -j > > On Feb 6, 1:37 pm, polyrhythmic <[EMAIL PROTECTED]> wrote: > > > You will have an easier time creating a single append by ,join() -ing > > an array of elements and adding them as a block. Forcing jQuery to > > evaluate each one individually creates a lot of repetition. > > The .domManip() code in the source is pretty legible, if you're > > curious. > > > Charles > > > On Feb 5, 3:00 am, George GSGD <[EMAIL PROTECTED]> wrote: > > > > I think it's generally proven that inserting dom objects is much > > > slower than innerHTML, for the kind of inserting you're trying, that > > > might be worth investigating... > > > > On Feb 4, 1:57 pm, Ashish <[EMAIL PROTECTED]> wrote: > > > > > Hi , > > > > > I am very new to jquery. I am using jquery 1.2.2 . I use jquery > > > > tablesorter to insert around 400 rows to a table. The data is > > > > collected using an Ajax call. > > > > > When new rows are inserted to the table the CPU utilization shoots up > > > > to 80%. All browsers freeze until the table is populated :( > > > > > I tried to insert 400 divs to a single div and faced the same problem. > > > > This rules out a problem with tablesorter. > > > > > Does jquery attach a lot of handlers to dom events that make appends > > > > very slow ? > > > > > Any suggestions would be much appreciated. > > > > > Thanks and regards, > > > > - Ashish