Lot of profiling shows that C++ streams are not the best way to performe file or text string manipulation when performance (speed) is required. Still, the standard streams are a good way to keep things type-safe.
From what I've read, most of the problem is because streams implementations have to 1) create/copy a lot of little objects 2) arnt fully generic (don't manage char and wchar the same way?) etc.
Anyway, I was thinking that maybe some C++0x would allow implementers to limit at least object creation/copy and maybe there are other features that would allow other performance improvements, maybe allowing to reach the printf() performance?
Is there an immediate impact? Or will we have to wait for new implementations? Or do we still need a new (STL-like) stream library?
You might be interested in some of the performance comparisons in my question here. Even the lowest level functions in the C++ standard library streams API are incredibly slow under common implementations, and looking through the source code of e.g. Visual C++'s stringbuf
class, I don't see copying of small temporary objects. So rvalue-references are not likely to help much.
AFAICT, the main reason for slowness of C++ iostreams is that library developers are stuck with a mindset that I/O is the bottleneck, so there's no point in worrying about performance of the I/O library. But I/O is decidedly not the bottleneck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With