istream_iterator for raw bytes?

Started by
11 comments, last by scottdewald 17 years, 7 months ago
Thanks for the clearing me up on vector being contiguous.

Are istreambuf_iterator's extremely slow? I ran some simple tests by reading in a file with istreambuf_iterator's and writing them out with ostream_iterator's vs. using fread() and fwrite() with a single char, and the latter was 5x faster. Is there any way to speed up iterators?
<a href="http://www.slimcalcs.com>www.slimcalcs.com
Advertisement
Check your compiler settings. If you're using (certain versions of) MSVC, iterators are "checked" by default, even in release mode, but you can disable that.
Quote:Original post by Zahlman
Check your compiler settings. If you're using (certain versions of) MSVC, iterators are "checked" by default, even in release mode, but you can disable that.

Thanks. I didn't realize it, but with my compiler, I had to explicitly turn on inlining. After doing that and turning on optimizations (-O), I got much better performance.
<a href="http://www.slimcalcs.com>www.slimcalcs.com

This topic is closed to new replies.

Advertisement