3 ms·
I have more issue with the poor performance of iostreams than with the interface, personally. Typesafe and type deducting string formatting is a pretty nice thi
by stormbrew 13y ago
I have more issue with the poor performance of iostreams than with the interface, personally. Typesafe and type deducting string formatting is a pretty nice thing to have.
- nikbackm 13y agoMaybe because iostreams are synchronized with stdio by default? It's possible to disable that for a big speed boost. There's also the issue that iostreams might be implemented on top of stdio for simplicity. Hard to make it faster in that case!
- stormbrew 13y agoEven then, it's pretty much the only place in the stdlib that extensively uses virtual calls, via std::locale. It's very complicated implementation-wise (I was actually working on an implementation of it once and it's not fun at all) and hard to find places to optimize it. It's not that it's too heavy for a console app's output, really, but for things like converting numbers to strings and vice-versa (a-la boost::format) it is definitely a lot slower than atoi/sprintf.