This gives a speedup of approx. 20% (for overloads which take TextWriter) to 40% (for overloads which don't take TextWriter) for inputs in which at least one character requires encoding.
These make the core implementations slightly slower but
provide the benefit of reducing allocations, which is
useful when these methods are called frequently by Razor.