In D58580 i have noted that llvm::to_string() is a memory hog.
It uses raw_string_ostream, and since it was buffered,
every raw_string_ostream had a cost of BUFSIZ bytes
(which is 8192 at least here). So every llvm::to_string()
call, even to just print an int, costed 8192 bytes.
In D58580, getting rid of that buffering had significant
performance and memory consumption improvements for llvm-xray convert.
Similarly, in D58580 @rnk pointed out that the raw_svector_ostream
is already unbuffered, and write_unsigned_impl and friends
do internal buffering. So it should be ok to also make
raw_string_ostream unbuffered.
Here, i don't have any perf measurements.
Another letdown is that i'm leaving a loose-end - not deleting the flush() method.
I don't expect that cleanup to be anything more than just fixing every
new compiler error, but i'm presently unable to do that.
Huh, I suppose that is nicer than calling SetUnbuffered.