I need to concatenate a bunch of strings in Javascript, and I'm looking for the fastest way to do this. Suppose Javascript is to create a large XML file, which naturally consists of many small lines. So I came up with:
var sbuffer = []; for (var idx=0; idx<10000; idx=idx+1) { sbuffer.push('<xmltag>Data comes here... bla... </xmltag>'); }
Ignore the loop or other "complex" code that builds the example.
My question is: for an unknown number of lines, do you have a faster algorithm / method / idea to combine many small lines into a huge one?
performance javascript join
Georgi
source share