[cfe-dev] some notes about templates

Larry Evans cppljevans at suddenlink.net
Mon Jul 1 08:51:33 PDT 2013


On 06/29/13 13:59, Nick Lewycky wrote:
> On 29 June 2013 11:00, Larry Evans
> <cppljevans at suddenlink.net
> <mailto:cppljevans at suddenlink.net>> wrote:
> 
>     On 06/28/13 19:07, Nick Lewycky wrote:
>     [snip]
>     > ActiveTemplateInstantiations shouldn't be a SmallVector in Sema, they
>     > should be allocated by a BumpPtrAllocator in ASTContext. Then we
>     can put
>     > ActiveTemplateInstantions in the AST, which will requiring
>     changing it a
>     > bit (no pointers to sema:: objects), but we also want to add a
>     template
>     > depth, correct point-of-instantiation SourceLocation and add missing
>     > instantiation records (such as instantiation due to overload
>     > resolution). An awesome outcome of this will be that we'll be able to
>     > produce template stack traces even when we aren't actively doing
>     > template instantiation. That would in turn allow us to do other things
>     > like flatten instantiation instead of making it recursive.
>     >
>     Would this flattening speed compile times?  Long compile times
>     is one strong reason why boost preprocessor is used to implement tuples:
> 
>     http://article.gmane.org/gmane.comp.lib.boost.devel/235386
> 
> 
> Not really, maybe only a tiny bit. What it means is that the depth of
> templates we can instantiate wouldn't be limited by our stack space, but
> by heap space.
> 
> I would be very surprised if clang has bad compile-time performance
> building tuples. Without thinking about it too hard, this sounds like
> something we should already be good at.
> 
> Nick

Hi Nick.

So you would also be surprised if Eric's benchmark mentioned in the
above boost.devel ml post showed little compile-time speed gain using
the preprocessor? (NOTE, as mentioned in the ml post, Eric
just used gcc, not clang).

-regards,
Larry





More information about the cfe-dev mailing list