JuliaLang/julia — comment on commit 538257c9943b8fcbade5628128fa0bfd302668b2
File:  line 0
By StefanKarpinski:

Ideally, print_to_array would just claim some space on the heap and keep growing (moving if necessary, but hopefully not), and then wrap the written chunk off to be the allocated memory of an array. Not sure if takebuf is this efficient already. For print_to_string, it would be nice to also have a version that watches the data as its printed, keeping track of wether buffer is ASCII or not so that at the end it could just wrap it the right way without having to rescan.