Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Larry Evans <cppljevans <at> suddenlink.net>
Subject: Re: tuple benchmarks show marked differences from std::tuple(was Re: Interesting article on stack-based TMP
Newsgroups: gmane.comp.lib.boost.devel
Date: Friday 26th October 2012 13:27:09 UTC (over 5 years ago)
On 10/25/12 11:58, Larry Evans wrote:
> On 10/24/12 14:09, Eric Niebler wrote:
> [snip]
>> I presented at BoostCon my own benchmarks of tuple with and without
>> preprocessing.
[snip]
>>
>> The source code is here:
>>
>> https://github.com/ericniebler/home/tree/master/src/tuple
>>
>
> I downloaded that and AFAICT:
>
>   * The preprocessor method is in:
>
>       unrolled_tuple.hpp
>
>     and is roughly the same as the vertical tuple implementation here:
>
>
>
http://svn.boost.org/svn/boost/sandbox/variadic_templates/sandbox/slim/test/tuple_impl_vertical.hpp
>
>
>     The main difference, AFAICT, is that unrolled uses aggregation
>     (via the member declaration:
>
>       tuple tail;
>
>     on line 133.  In contrast, the vertical tuple uses inheritance:
>
>       struct tuple_impl TUPLE_IMPL_TYPE_NAME), Others...>
>       : tuple_impl
>
>     as shown on line 42 of the .hpp file.
>
[snip]
>
>   * The variadic template method is in:
>
>       tuple.cpp
>
>     which is close to that here:
>
>
>
http://svn.boost.org/svn/boost/sandbox/variadic_templates/sandbox/slim/test/tuple_impl_horizontal.hpp
>
>     in that both methods use multiple inheritance with an int key type
>     paired with the tuple element type. In the case of tuple.cpp, the
>     pairing is done with:
>
>       template
>       struct tuple_elem
>
>     in tuple_impl_horizontal, pairing is done with:
>
>       template
>       struct element
>       ;
>       template
>       struct element,Value>
>       {
>           Value value;
>       };
>
>     The get functions are essentially the same.
>
[snip]
Actually, another, maybe significant difference, is the templated
CTORs in the BoostCon implementations.  The sandbox/slim
implementations don't have them, relying just on the default CTOR's
for the tuple elements.

Currently in the sandbox slim/test directory:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/sandbox/slim/test/

there's

  tuple_impl_bcon12_horizontal.hpp
  tuple_impl_bcon12_vertical.hpp

As indicated in comments within these files, the code was copied from
files in:

  https://github.com/ericniebler/home/tree/master/src/tuple

and then slightly modified to allow use in the
tuple.benchmark.mini.cpp in the sandbox slim/test directory.  The
python program in that directory was also modified to use these 2 new
implementations.  The resulting test output is also in the sandbox
slim/test directory in file:

  tuple.benchmark.mini.time.txt

It shows that the bcon12 implementations:

  tuple_impl_bcon12_horizontal.hpp
  tuple_impl_bcon12_vertical.hpp

compile significantly slower than the original implementations:

  tuple_impl_horizontal.hpp
  tuple_impl_vertical.hpp

I hadn't expected that since, as mentioned above, there didn't seem to
be that much difference in the 2 implementations.

Anyone have any theories on why that's the case (I wouldn't think the
templated CTOR's would cause any slowdown since they're not used).

-regards,
Larry




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
 
CD: 3ms