|
Boost : |
Subject: Re: [boost] Reimplementation of the MPL for C++11
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-10-22 09:27:32
On 10/21/13 22:51, Agustín K-ballo Bergé wrote:
> On 22/10/2013 12:28 a.m., Larry Evans wrote:
>> On 10/20/13 10:33, Agustín K-ballo Bergé wrote:
>>> On 20/10/2013 09:04 a.m., Larry Evans wrote:
>> [snip]
>>>> The code here:
>>>>
>>>> http://svn.boost.org/svn/boost/sandbox/variadic_templates/sandbox/slim/
>>>>
>>>> might be helpful. It was based on Chrisopher's code but had
>>>> to be modified slightly as mentioned in the post:
>>>>
>>>> http://comments.gmane.org/gmane.comp.compilers.clang.devel/24145
>>>>
>>>> which also mentions the slow compile times when not using the
>>>> preprocessor.
>>>>
>>>
>>> Compilers appear to have improved since then! I decided to take gcc4.8.1
>>> and fusion::map for a spin, since I happen to have a variadic
>>> implementation of map that does not use recursion. The results of this
>>> crude exercise can be found here:
>>> https://gist.github.com/K-ballo/a44590159133997abcdc
>>
>> This link only has the test driver code and the test results file.
>> Could you please provide a link to the implementation of this
>> non-recursive map?
>>
>
> Certainly, you can find the proof of concept implementation I used for
> the tests here: http://fusionfenix.com/ktests/boost.fusion.map.zip
> It is intended to be used with Boost.Fusion from trunk, you just need to
> replace fusion's "map" directory with the "map_" one in the zip.
>
> Keep in mind that it is just a proof of concept. I am working on a full
> fledged implementation as time permits, which is not as often as I would
> like.
>
> Regards,
The map.hpp in the zip file shows it uses the preprocessor:
--{--cut here--
namespace boost { namespace fusion
{
struct void_;
struct fusion_sequence_tag;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, typename T)>
struct map :
sequence_base<map<BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> >
{
struct category : random_access_traversal_tag, associative_tag {};
--}--cut here--
with an option to use some preprocessed headers:
--{--cut here--
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/map/detail/cpp03/preprocessed/map.hpp>
#else
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output:
"detail/preprocessed/map" FUSION_MAX_MAP_SIZE_STR ".hpp")
#endif
--}--cut here--
The test results contain, for C++98:
--{--cut here--
C++98:
Execution times (seconds)
phase parsing : 5.29 (97%) usr 349702 kB (98%) ggc
--}--cut here--
and:
--{--cut here--
C++98 (preprocessed):
Execution times (seconds)
phase setup : 0.01 ( 0%) usr 547 kB ( 0%) ggc
phase parsing : 2.64 (93%) usr 112842 kB (95%) ggc
--}--cut here--
However, there's no (preprocessed) indicator for the C++11 results.
Instead, there's only:
--{--cut here--
C++11 (recursive):
Execution times (seconds)
phase setup : 0.01 ( 1%) usr 653 kB ( 1%) ggc
phase parsing : 0.88 (70%) usr 74763 kB (88%) ggc
--}--cut here--
and:
--{--cut here--
C++11 (non-recursive):
Execution times (seconds)
phase parsing : 0.79 (95%) usr 70483 kB (96%) ggc
--}--cut here--
Was:
defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
for the both C++11 tests or not?
BTW, the difference between C++11 (recursive) and (non-recursive)
was certainly dramatic for the results prefixed with:
255 elements in a fusion::map, accessing the 129th one
test (56.93 vs 2.90).
Looks promising.
-regards,
Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk