Boost logo

Boost :

Subject: Re: [boost] [multiprecision] Help needed with strange constexpr slowdown
From: John Maddock (jz.maddock_at_[hidden])
Date: 2018-01-03 18:27:23

> I actually found that gcc produced better code when string literals were static
> const and not constexpr.

Thanks for everyone who's commented here or on the bug tracker.

What's clear is that pre-gcc-7 there is a very noticeable slowdown for
functions where a temporary with a constexpr constructor relies on the
named-return-value-optimisation.  Even with gcc-7 there are non-trivial
changes to the assembly produced, where I would have expected them to be
identical (given that the temporary is constructed in a non-constexpr
context).  Still, at least the performance is the same.  In any case,
it's clear that these new features can have strange unintended consequences.

Best, John.

This email has been checked for viruses by AVG.

Boost list run by bdawes at, gregod at, cpdaniel at, john at