[Patch] [add changelog] reduce template instantiation depth in <variant>

Barrett Adair barrettellisadair@gmail.com
Wed Nov 16 01:00:00 GMT 2016


On Mon, Nov 14, 2016 at 12:05 PM, Tim Shen <timshen@google.com> wrote:
> On Sun, Nov 13, 2016 at 10:53 AM, Barrett Adair wrote:
>> My last benchmark didn't have any short-circuiting. Here's a benchmark where
>> the first type is not default-constructible, copy-constructible, or
>> move-constructible:
>>
>> http://output.jsbin.com/himusodozu
>>
>
> This is interesting result!
>
> I saw a slight slow-down after the change, even for 20 alternatives.
> So I'm not sure which way to go.

Interesting, do you have an example of the types you are using?
If so, I could experiment with more benchmarks. How slight was your slowdown?

> Do you have a concrete use case of creating a variant with 400 alternatives?

Yes, for an internal application I'm dealing with 350+ generated IDL types. It
would be the most elegant solution for the problem, save for that fact that it
takes 6 hours to compile the main translation unit (under a larger ftemplate-
depth setting). That is a different problem for a different day, though :)

Cheers,
Barrett



More information about the Libstdc++ mailing list