Foundation.StringBuilder probably does not need a whole lot of explination: it builds strings fast.
To demonstrate, we'll first create large strings using concatination and see how long it takes. Then we'll build the same strings using the Foundation.StringBuilder and compare the times.
function concatString(num) { var start=Date.parse(new Date()); var s=""; for (var i=0;i<num;i++) s+="lets make a really long string "; var stop=Date.parse(new Date()); alert("It took "+((stop-start)/1000)+" seconds to concat the string, it's length is "+s.length); }
Now, a similar function to create large strings using Foundation.StringBuilder:
function buildString(num) { var start=Date.parse(new Date()); var s=new Foundation.StringBuilder(); for (var i=0;i<num;i++) s.append("lets make a really long string "); s=s.toString(); var stop=Date.parse(new Date()); alert("It took "+((stop-start)/1000)+" seconds to build the string, it's length is "+s.length); }
In Internet Explorer, the builder takes far less time. On my machine, it takes 2 seconds for the 100,000 build, but has never returned for the 100,000 concat.
In Firefox, the difference is not so great. On my machine it takes about 9 seconds for the 100,000 build, and 11 seconds for the 100,000 concat.
If you are creating a lot of HTML or XML on the client side, most of your clients will see a marked improvement if you use a builder.