VirusMinus
asked on
javascript array looping and string concatenation
I have a string of product options thats one huge string where the options are separated by the ~ character. total options are over 3000.
Whats the fastest (best performing) way to make this into a select with each of the product options going into <option>product option</option> elements?
I can use jQuery also
Whats the fastest (best performing) way to make this into a select with each of the product options going into <option>product option</option> elements?
I can use jQuery also
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Nope...can't prove it. But, it's pretty darn efficient.
However - your question is about parsing a concatenated string, not concatenating a string. So, is this *more* efficient than parsing using javascript and some sort of i++ loop - don't know.
ASKER
Not exactly but it helped
ASKER
and also can you prove that appending as you have suggested 3000+ times is faster than other concatenation methods?
like
http://www.bloggingdeveloper.com/post/JavaScript-Array-Join-vs-String-Concatenation-Avoid-String-Concatenations-Major-Hit-on-Performance.aspx
http://stackoverflow.com/questions/153381/javascript-string-concatenation-faster-than-this-example
http://www.softwaresecretweapons.com/jspwiki/javascriptstringconcatenation
http://snippets.dzone.com/posts/show/29
http://devpro.it/examples/loopsbench/
http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/