You do not say how you write XML or where you write XML.
If you write a line. Stop it and write a stream.
If you are writing a buffer string, look at the size of the buffer. If you write on an ASP.NET page or handler, then call Response.Flush () at regular intervals.
There is balance, since writing to the buffer is almost always faster than writing to the stream. However, writing to the auto-resize buffer will be slower the larger the image size. What else, no matter what XML is processing, cannot take action until it starts to receive some, which does not happen until the first reset.
Thus, there may be room for improvement, although calls to a web service are likely to outweigh what can be achieved. Perhaps this can also be improved if you rewrite the parsing of the response to the web service so that it yields as it is parsed, which means that you can start processing the response before receiving the entire response.
Jon hanna
source share