Boost logo

Boost :

Subject: Re: [boost] [metaparse] Review period starts May 25th and ends June 7th - ongoing
From: Lee Clagett (forum_at_[hidden])
Date: 2015-06-08 10:29:01


On Mon, Jun 8, 2015 at 1:03 AM, Abel Sinkovics <abel_at_[hidden]> wrote:

> Hi Lee,
>
> Thank you for the review.
>
> On 2015-06-08 04:34, Lee Clagett wrote:
>
>> * Adding support for the Gcc character-literal expansion extension would
>> be
>> nice, because the strings macro has some intense pre-processor work.
>>
> Do you mean multi-character literals? (eg. 'abcd'?)
>

I thought Louis mentioned this [
https://github.com/ldionne/hana/blob/master/include/boost/hana/string.hpp#L83
]. No need for the pre-processor with the extension.

>
> * Compiling in C++11 mode is noticeably quicker for some of the examples I
>> tried (in clang and gcc) - due to the true variadic string implementation
>> (no pre-processor)?
>>
> I'm not aware of a speed gain in switching to C++11 mode. Could you point
> me to the example and the compiler version/flags you were using? I'd like
> to learn more about where that comes from (it could be useful to reduce
> compilation times).
>
> What I'm aware of is that some of the examples only print "Please use a
> compiler that support constexpr" when the string macro is not supported
> (eg. calculator_with_parens_and_unary_ops example). Because of this, in
> pre-C++11 mode, they compile quicker as they don't run the metaprograms.
>

The calculator example. My Linux box has an older core 2 (7+ years old),
and the OSX box has a much newer chip. The compiler options were just
`(clan)g++ -I ~/code/mpllibs main.cpp` with `-std=c+11` added for cpp11.

Compiler c++03 c++11
-------------------------------------------------
g++ 4.8.4 Gentoo Linux ~10.5s ~3.5s
clang++ 3.5 Gentoo Linux ~5.8s ~2.6s
clang++ 3.5 OSX ~2.1s ~1.0s

These are repeatable, so weird caching effects should be minimal. It also
seems unlikely that the flag would introduce faster code paths internally
in both compilers. The interesting part comes when adding -E to run the
pre-processor only. I timed this while redirecting output to /dev/null. Not
the greatest test, but still interesting:

Compiler c++03 c++11
-------------------------------------------------
g++ 4.8.4 Gentoo Linux ~9.2s ~2.1s
clang++ 3.5 Gentoo Linux ~4.7s ~1.3s
clang++ 3.5 OSX ~1.6s ~0.9s

The g++ output is 41kb smaller in cpp11 mode. I looked at the output to
find the difference, but its not easy when both are 1.5MB of text. `diff`
is not helpful. At first glance the mpl includes seem to be the same (I
didn't spot any pre-processed includes cheating). Also FWIW, the Linux box
is using a standard boost 1.55 release, while the OSX is using a master
checkout of boost from several weeks ago.

Lee


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