<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 - Add specializations of small std::tuple to reduce pre-optimization code generation"
   href="https://bugs.llvm.org/show_bug.cgi?id=46974">46974</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add specializations of small std::tuple to reduce pre-optimization code generation
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dsharlet@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I've noticed that if I replace std::make_tuple(a, b) with std::make_pair(a, b)
where I can, I get a few percent reduction in the size of -S -emit-llvm -O0,
and build time with -O2 appears to go down by 3-5%. I didn't change anything
else (kept using std::get<0>/std::get<1> to access these tuples).

The thing is, std::tuple(a, b) where I know there are exactly two elements is
only a very small fraction of the tuple usage in my project. There are still
many usages of std::tuple<T...> where sizeof...(T) is 2, but I don't know that
at compile time. My program makes heavy use of tuple_cat and make_tuple. The
vast majority of the tuple usage is for <= 5 tuple elements.

It seems like if there were a special case implementation of std::tuple<>,
std::tuple<T>, std::tuple<T1, T2>, ... up to some small finite number of types,
it could have a significant impact on the pre-optimization code size and build
time of tuple-using code.</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>