[libcxx-commits] [PATCH] D144568: [libc++][NFC] Refactor the __enable_ifs in <string>

Alexander Kornienko via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 28 14:44:35 PDT 2023


alexfh added a comment.

In D144568#4227999 <https://reviews.llvm.org/D144568#4227999>, @philnik wrote:

> In D144568#4227982 <https://reviews.llvm.org/D144568#4227982>, @alexfh wrote:
>
>> This commit increases compilation time by ~15% and increases recursive template instantiation depth (thus, requiring adjusting `-ftemplate-depth=2048`) in some of our internal test code. Admittedly, it's using templates in a sort of a compiler-load-test-like way, but this change may affect compilation time for real code as well (it's just not likely to hit the default `-ftemplate-depth=1024` limit and I don't have a good idea of how to find this code with reasonable effort).
>>
>> Was this sort of a compiler time regression anticipated with for this change?
>
> I didn't expect really any change w.r.t. compile time. I also don't see how it would affect the amount of recursive template instantiations, since it doesn't add any layers. It just moves the instantiations into the type list. Do you have any specific cases where it changes?

Yes, I have a specific test, but it will take some time to reduce it and make it shareable. I'm working on this.

So far the only additional piece of diagnostic information I have is a snippet of differences from compilation with `-Xclang=-print-stats` (`-` before this patch, `+` after the patch), which show some differences in the structure of code handled by the compiler:

  -    3841 NonTypeTemplateParm decls, 88 each (338008 bytes)
  +    4055 NonTypeTemplateParm decls, 88 each (356840 bytes)
  ...
  -    50763 ConstantExpr, 24 each (1218312 bytes)
  +    83902 ConstantExpr, 24 each (2013648 bytes)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144568/new/

https://reviews.llvm.org/D144568



More information about the libcxx-commits mailing list