From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-02-02 10:04:29


Thorsten Ottosen wrote:
> Tobias Schwinger wrote:
>
>>Putting fixed_stringS into STL containers (which in turn could use
>>a custom allocator, e.g. Boost.Pool) can significantly reduce the
>>allocation costs (and would be my no.1 use case for such a library).
>>
>
> have you tried to benchmark fixed_string compared to std::string with
> the short string optimization?
>

It isn't necessary, given that not all implementations of the standard library provide this optimization IMO.

Even if they would: it is still easy to come up with a case where the assumptions the optimization is based on won't hold (as enough copying and a fast special-purpose allocator can make a string with SSO perform worse than without) ==> the more control, the better (applies not only to strings but to memory management in general).

Regards,

Tobias