Pre-allocate buffers when adding string

We do a conservative estimate of the number of characters, but still,
this limits the number of buffer reallocs to a small constant.
1 file changed