[any] Possible improvement?

As far as I understand it is possible to use in boost::any techniques similar to boost::function. I.e. split virtual behavior and actual data. It will help to avoid heap allocation while copying boost::any with stored small objects. What do you think about adding it to next releases of boost?

Sergei Politov wrote:
As far as I understand it is possible to use in boost::any techniques similar to boost::function. I.e. split virtual behavior and actual data. It will help to avoid heap allocation while copying boost::any with stored small objects.
What do you think about adding it to next releases of boost?
Personally, I wonder if it wouldn't be more interesting to create an unified allocator system that allows Small Buffer Optimization, rather than rewriting the wheel for every component that may need it.

On Wed, Mar 19, 2008 at 4:20 PM, Mathias Gaunard wrote:
Sergei Politov wrote:
As far as I understand it is possible to use in boost::any techniques similar to boost::function. I.e. split virtual behavior and actual data. It will help to avoid heap allocation while copying boost::any with stored small objects.
What do you think about adding it to next releases of boost?
Personally, I wonder if it wouldn't be more interesting to create an unified allocator system that allows Small Buffer Optimization, rather than rewriting the wheel for every component that may need it.
From a certain point of view, the small object optimizations used by boost::function is separate from optimizing memory allocations, as it avoids the need to allocate memory. In addition, it improves cache coherency.
I agree that boost::any can benefit not only from small object optimizations but also from the new allocator semantics of std::function, as defined in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2308.html (which are identical to the allocator support in shared_ptr.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

You can have a look at the optional polymorphic value object in the vault ( http://tinyurl.com/2og6st). In the accompaining examples (http://tinyurl.com/2o3wrn), there is a sample re-implementation of boost::any that benefits from the small object optimization guaranteed by the polymorphic container. Corrado * * On Wed, Mar 19, 2008 at 1:39 PM, Sergei Politov <spolitov@gmail.com> wrote:
As far as I understand it is possible to use in boost::any techniques similar to boost::function. I.e. split virtual behavior and actual data. It will help to avoid heap allocation while copying boost::any with stored small objects.
What do you think about adding it to next releases of boost?
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- __________________________________________________________________________ dott. Corrado Zoccolo mailto:zoccolo@di.unipi.it PhD - Department of Computer Science - University of Pisa, Italy -------------------------------------------------------------------------- The self-confidence of a warrior is not the self-confidence of the average man. The average man seeks certainty in the eyes of the onlooker and calls that self-confidence. The warrior seeks impeccability in his own eyes and calls that humbleness. Tales of Power - C. Castaneda

Corrado Zoccolo wrote:
You can have a look at the optional polymorphic value object in the vault ( http://tinyurl.com/2og6st). In the accompaining examples (http://tinyurl.com/2o3wrn), there is a sample re-implementation of boost::any that benefits from the small object optimization guaranteed by the polymorphic container.
Why not: typedef poly<void> any; Regards, -- Shunsuke Sogame
participants (5)
-
Corrado Zoccolo
-
Emil Dotchevski
-
Mathias Gaunard
-
Sergei Politov
-
shunsuke