Re: [libxml++] write_to_stream speed



On Sun, Sep 28, 2003 at 11:33:55PM +0200, Christophe de Vienne wrote:

> I've made small tests with write_to_stream and write_to_string.
> It appeared that using write_to_stream is _much_ slower than write_to_string 
> then sending the result to the stream, even if using a ostringstream instead 
> of std::cout.

This *might* be because write_to_string followed by one call to
operator<<(ostream,string) can use the length of the string and perform
a single write, whereas write_to_stream will perform several writes to
the output location (whether it's a stringstream's buffer or stdout).

Which compiler version did you test this with?
There's been a *lot* of work on improving iostream performance in GCC
recently, some of this won't land until GCC 3.4, but the 3.3.x branch
has some improvements too.

jon

-- 
"Any view of the universe that is not strange is false."
	- Neil Gaiman




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]