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.