<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Exorbitant compile times"
   href="https://bugs.llvm.org/show_bug.cgi?id=39353">39353</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Exorbitant compile times
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>lumosimann@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was just experimenting a bit and realized that cache might miss some cache
opportunities:

```
#include <iostream>
#include <tuple>
#include <type_traits>

template <size_t I0, size_t... I>
struct Recursion {
    using type = std::tuple<
        typename Recursion<I0 - 1, I - 1, I - 1, I - 1, I - 1>::type...>;
};
template <size_t... I>
struct Recursion<0, I...> {
    using type = std::integral_constant<int, 0>;
};

template <std::size_t I, typename T>
struct SomeWrapper {
    using type = std::tuple_element_t<0, T>;
};

template <size_t I>
using ComplexType = typename Recursion<I, I, I, I, I>::type;

struct SimpleType {
    using type = int;
};

template <typename T>
struct Concept : std::bool_constant<std::tuple_size_v<typename T::type> != 4> {
};

template <typename T>
std::enable_if_t<Concept<T>::value, int> g(T) {
    return 3;
}
template <typename T>
std::enable_if_t<!Concept<T>::value, int> g(T) {
    return 3;
}

template <std::size_t... Is>
int f(std::index_sequence<Is...>) {
    return (... + g(SomeWrapper<Is, ComplexType<9>>{}));
}

int main() {
    std::cout << f(std::make_index_sequence<200>()) << std::endl;
    return 0;
}
```

Compilation time for this code scales linearly with Clang (linear in terms
ofthe number in `make_index_sequence`), but remains constant for gcc. 

The whole thing is just setting up a huge type that is used in SFiNAE for
evaluating g. It looks like Concept<T> is not cached during consecutive calls
to g.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>