On Tue, 31 May 2016, Chris Muller wrote:
It's an optimization, so it's not mandatory. Of course it's nice to have,
An optimization of what? Execution speed? Is it such an optimization that any human could ever possibly notice? Setting the mode of a stream, really?
I suspect that you expect one to set mode at most once per stream, which is not always the case. I could easily give you an artificial benchmark showing 30x speedup, but that would make no sense. It's a library method and as such, why not make it quicker when possible?
I like most of your optimizations but, IMO, this one is so infinitesmal, I don't think it exceeds the cost of the decreased legibility / complexity..
Please explain the legibility / complexity part.
Levente