Boost logo

Boost :

Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-03-02 10:35:38


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 02 March 2009, Thorsten Ottosen wrote:
> you might not expect 95% of all lines to be less than 512 chars. Thus
> you can use
>
> boost::auto_buffer<char,512> buffer;
>
> to avoid heap-allocations in 95% of the cases. This can be a major
> speed-improvement. For the remaining 5% of the cases, the buffer will be
> placed on the heap, but the code from the user's persective remains the
> same.

- From glancing at the implementation posted to the list, it does not appear to
fall back to heap allocation once the maximum stack capacity is reached.
push_back() simply asserts that the stack capacity hasn't been used up yet.
Although, I would be able to use such a container if it were added as a
utility to boost, as I implemented one for my own use as an internal
optimization in Boost.Signals2 (boost/signals2/detail/stack_vector.hpp and
stack_allocator.hpp).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkmr/MsACgkQ5vihyNWuA4XaiQCgtM4TxduJuLQ6+Zw7+Jlw2ddp
1DYAoNj+MXS6R+jHy3v7HJHsbjfbJWlf
=5p8M
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk