Improve the performance of AsciiHeadersEncoder

I expected that hotspot will handle this sort of optimization but it
doesn't always seem so.