[LLVMdev] std::string

Chris Lattner clattner at apple.com
Sat Jan 19 18:36:56 PST 2013


On Jan 19, 2013, at 6:00 PM, Krzysztof Parzyszek <kparzysz at codeaurora.org> wrote:
> On 1/19/2013 7:55 PM, Sean Silva wrote:
>> 
>> Although SmallString is actually pretty inefficient, since it keeps
>> the string data separate from the "vector" header. I believe libc++'s
>> std::string actually reuses the pointers in the "vector header" as the
>> storage for the "small" size, and so in that case std::string is
>> effectively a very memory efficient SmallString with storage of
>> roughly 3 pointers' worth of chars.
> 
> Why do we actually have all the local versions of containers that already exist as a part of the C++ standard (such as SmallVector, DenseMap, et al.)?

See:
http://llvm.org/docs/ProgrammersManual.html#picking-the-right-data-structure-for-a-task

-Chris




More information about the llvm-dev mailing list