https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67579
Bug ID: 67579 Summary: [concepts] Memoization for constraint expressions Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- While implementing the Ranges TS I've found that the implementation of concepts in GCC scales very poorly to larger and more complex systems. I've been able to achieve 1-2 order of magnitude improvements in compile time and memory usage by hand coding memoization for some concepts with constexpr variable templates. E.g., replacing template </* parameters */> concept bool Foo = // requirements with template </* parameters */> constexpr bool Foo_ = false; template </* parameters */> requires // requirements constexpr bool Foo_</* parameter names */> = true; template </* parameters */> concept bool Foo = Foo_</* parameter names */>; which is fine when Foo need not participate in subsumption relationships. If Foo *does* need to participate in subsumption relationships then performing this transformation by hand is not possible since it hides the relationship between Foo and "requirements" from the compiler's view. If concepts & constraint expressions are to be generally applicable the implementation must provide some means of reducing the cost of repeated evaluation.