[RFC/Patch] What about using seekoff(-1, ...) for unbuffered underflow?
Paolo Carlini
pcarlini@unitus.it
Fri Jun 6 16:08:00 GMT 2003
Benjamin Kosnik wrote:
>>Well, seeking after every _unbuffered getc()_ (vs. buffered and/or sbumpc)!
>>
>>
>Right. This is sub-optimal, considering pback can be used. I don't think
>you disagree about this part, actually.
>
I don't. But I also believe that a fundamental tenet of iostreams is
that of having the simplest and cleanest streambuf inlines. All the
complexity should be hidden into the virtuals. And those people who
really want single char performance use buffered sbumpc() not unbuffered
sgetc()! Do you concur?
Moreover, these design choices are also for the benefit of people who
want to inherit from streambuf and expect a clean, fast implementation,
upon which to build.
>>On the other hand, an heavier sbumpc() affects any sbumpc(), buffered or not
>>and I think that, for top performance, people really want a fast unbuffered
>>sbumpc().
>>
>>
>I'm sympathetic to your purity test on _M_buf_size, but I think your
>proposed cure is worse than the disease...
>
It depends ;)
I don't think we should trade some speed for unbuffered sgetc() for
speed for buffered (this is important!) or unbuffered sbumpc(). Of
course, I will do my best in the next hours to have both but if turns
out to be impossible I would be really really sorry...
Paolo.
More information about the Libstdc++
mailing list