Real world use of string concatenation proven to be very slow in Webkit based browsers. Note that for the sake of the browser, I've reduced the loop down from 100,000 iterations to 1,000 iterations.
Full detail of problem shown in this Opera article by Erik Möller.
Here is my follow up comment, suggesting that although Webkit, and Chrome in particular claim to have string concatenation licked, it's still a problem and can only be solved (for this real world problem) by using array joins.
Update - I'm no longer convinced the concat is the issue, though switching to the array solves the problem:
Damn, after almost being able to sleep on this, I more and more think the problem isn't the concat, but the index lookup - which is what's been already discussed. Obviously the array provides the solution because it has the native index support - whereas swapping data[i] out for data.substr(i, 1) yields almost exactly the same results ref.
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Compare results of other browsers
/edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published by Remy Sharp