in reply to what's faster than .=

I don't have time to Benchmark it at the moment, but you might also try print'ing a character at a time to a temp file.

Update: my benchark code shows that printing is 20-25% faster than appending to a variable, unless the variable is preallocated to the desired length. Then appending is 4-5 times faster. YMMV.