I guess that you are trying to get answer if the run-time solution (described in the link) won't be an issue in production, right? Well, as mentioned here:
Memory Efficiency and Performance of String.Replace .NET Framework
you should do some own benchmarking. To be sure, that replacing chars of a big report
for many users won't kill the performance.
But my suggestion is do it in run-time. Maybe better in AOP filter. At once, when all the response is finished (I am doing similar functionality replacing some strings).
public virtual void OnResultExecuted(ResultExecutedContext filterContext)
{
// Change result as needed
filterContext.HttpContext.Response.Filter =
new ResponseStream(filterContext.HttpContext.Response.Filter);
}
And here is the Stream
protected class ResponseStream : MemoryStream
{
readonly Stream _stream;
public ResponseStream(Stream stream)
{
_stream = stream;
}
public override void Write(byte[] buffer, int offset, int count)
{
//base.Write(buffer, offset, count);
string html = System.Text.Encoding.Default.GetString(buffer);
// TODO - here remove spaces...
byte[] outdata = System.Text.Encoding.Default.GetBytes(html);
//write bytes to stream
_stream.Write(outdata, 0, outdata.GetLength(0));
}
}
The second think, could be enabling of the dynamic compression on your IIS (if using IIS 7.0 please read http://technet.microsoft.com/en-us/library/cc753681%28v=ws.10%29.aspx)