I am trying to squeeze as much performance as i can from a custom HttpHandler that serves Xml content.
I\' m wondering which is better for performance. Using the Xm
I agree that XmlWriter is better for code maintainability, but if we are talking about performance optimization, you should avoid both XmlWriter and StringBuilder.AppendFormat, because using a formatter ruins performance.
changing
sb.AppendFormat("{0} ", content);
to
sb.Append("").Append(content).Append(" ");
makes the StringBuilder version 2.5 times faster then the other from Robert's answer.