[any] small buffer optimizations?

Hi, As eplained in http://www.codeproject.com/KB/cpp/dynamic_typing.aspx boost::any is not exactly optimal w.r.t. efficiency. Diggins implementation avoid allocation for objects smaller or equal to sizeof(void*). Personally I think this is too small a buffer; Boost.Function uses at least two words; I think it might be worth to go for 3 words. Would anyone be interested in implementing this? best regards -Thorsten

I second that, and may I also suggest adding allocator to boost::any like in boost::shared_ptr and boost::function? Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode On Wed, Jul 16, 2008 at 1:33 PM, Thorsten Ottosen <thorsten.ottosen@dezide.com> wrote:
Hi,
As eplained in
http://www.codeproject.com/KB/cpp/dynamic_typing.aspx
boost::any is not exactly optimal w.r.t. efficiency. Diggins implementation avoid allocation for objects smaller or equal to sizeof(void*). Personally I think this is too small a buffer; Boost.Function uses at least two words; I think it might be worth to go for 3 words.
Would anyone be interested in implementing this?
best regards
-Thorsten _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

AMDG Thorsten Ottosen wrote:
As eplained in
http://www.codeproject.com/KB/cpp/dynamic_typing.aspx
boost::any is not exactly optimal w.r.t. efficiency. Diggins implementation avoid allocation for objects smaller or equal to sizeof(void*). Personally I think this is too small a buffer; Boost.Function uses at least two words; I think it might be worth to go for 3 words.
Would anyone be interested in implementing this?
I think this would be a good idea as long as swap is a) correct (the version listed in the article isn't) b) no-throw. In Christ, Steven Watanabe

Thorsten Ottosen wrote:
Hi,
As eplained in
http://www.codeproject.com/KB/cpp/dynamic_typing.aspx
boost::any is not exactly optimal w.r.t. efficiency. Diggins implementation avoid allocation for objects smaller or equal to sizeof(void*). Personally I think this is too small a buffer; Boost.Function uses at least two words; I think it might be worth to go for 3 words.
Would anyone be interested in implementing this?
I've been interested in creating a policy-based framework to handle stack-only allocation, SBO, allocators and the never-empty guarantee for a while, but I haven't found the time to do so yet. All single object containers could use that, so it's best to factorize in my opinion. Of course, any can be empty, so stack allocation is not such a problem.
participants (4)
-
Emil Dotchevski
-
Mathias Gaunard
-
Steven Watanabe
-
Thorsten Ottosen