
On 12 November 2013 17:13, Eric Niebler
On 11/12/2013 8:21 AM, Evgeny Panasyuk wrote:
12.11.2013 19:41, Eric Niebler:
I've now built a filter_range, transform_range, and an istream_range in this vein. Initial results are looking promising, but I haven't benchmarked performance, yet. A commenter on my blog claims to have benchmarked perf of istream_range, with good results, which is encouraging.
While new "slim" istream_range is faster than version with "fat" iterators, it is still not the fastest possible. In particular, it does two comparisons per cycle iteration: one is "!rng_->next()", and another is comparison of iterators, like "it != last". <snip>
The commenter on my blog claims this extra check is optimized away by a smart compiler like gcc. He says[^1]:
Regardless of efficiency, a range adaptor could make implementing input and forward ranges much easier.