|
|
|
|
|
by pennig
5533 days ago
|
|
Looks like WebKit has problems appending to a very long string. The less we can do that the better, so I came up with this solution: var dest = 'apple';
while (dest.length < 100000) {
var out = '';
for (var i=dest.length-5, end=i+10; i<end; ++i)
out += dest[i];
dest += out;
}
That brought the time from about 4 seconds to a more respectable 90 msec. |
|
* And by quadratic I mean "copies the whole string every time" such that an append loop is N^2 while a push+join is linear.