Please sign in to comment.
Eliminate unnecessary resizes from encodeUtf8.
We had been performing a resize any time that (a) we had data to write and (b) we got to within 4 bytes of filling the target bytestring. This was safe, but suboptimal, as it meant that in the common case of encoding ASCII text, we would *always* perform a resize. Now, we check the exact number of bytes we need to fit, and resize only if they won't fit. This eliminates resizes for ASCII data, and makes them a little less likely for other data.
- Loading branch information...