[llvm-commits] [llvm] r78924 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp

Dan Gohman gohman at apple.com
Thu Aug 13 11:54:31 PDT 2009


On Aug 13, 2009, at 10:55 AM, Daniel Dunbar wrote:


> On Thu, Aug 13, 2009 at 10:41 AM, Dan Gohman<gohman at apple.com> wrote:
>
>> Author: djg
>>
>> Date: Thu Aug 13 12:41:40 2009
>>
>> New Revision: 78924
>>
>>
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=78924&view=rev
>>
>> Log:
>>
>> Set raw_os_ostream, raw_string_ostream, and raw_svector_ostream to be
>>
>> unbuffered. std::ostream does its own buffering, and std::string and
>>
>> SmallVector both have allocation strategies intended to handle  
>> frequent
>>
>> appending.
>>
>
>
> Eek!
>
> Did you profile the effects of this change? I expect that this
> dramatically slows down these streams. One of the main values of being
> buffered in raw_ostream is that we hit all the fast paths to quickly
> output small strings. Making all of these strings unbuffered nullifies
> several of these optimizations.

Yes, it appears to be a slight win, when it matters. Do you have use
cases where the optimizations outweigh the cost of an extra malloc+free
and extra copying?

Dan




More information about the llvm-commits mailing list