On Fri, Sep 7, 2012 at 2:09 PM, Szymon Gatner
May I ask tho: why are you using a stream to write a block of memory to a string? Why not just directly copying it to a vector (or a string)?
These are good questions. The short answer is I am pseudo-profiling... aka profiling by "divine inspiration" rather than actually looking at the results of a profiler... which is often a waste of time but this time seemed to help. My original code wrote many small batches of binary data to std::cout (think hundreds of thousands of calls to std::cout::write). I modified the routine to use boost's filtering_ostream to write many small blocks to a string. Then write that string to stdout with just one call to std::cout::write. This reduced the number of calls to std::cout::write by a factor of 100,000 or so. In my real case, unlike the example I posted here, the data I am writing is not from one contiguous block. Thank you! Chris