<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/129318>129318</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Optimize std::find_end
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++,
            performance
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ldionne
      </td>
    </tr>
</table>

<pre>
    That algorithm is super slow, I noticed while benchmarking it. We could probably short-circuit it with a `std::find` for the first element of the needle. We should also consider starting from the end for bidirectional iterators if we don't already.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxUkc2K3DAQhJ9GvjQ7aNrjsefgw_4wkFMugRyDftpWJ7JkpPYOm6cPNgtJQCAo0FdVKlMrz4loVN2L6t4as0nIZYyec0rU2Ow_xm_BCJg458ISFuAKdVupQI35ofAVvkDKwo48PAJHAkvJhcWUX5xmYDnBdwKXt-hhLdkaGz-ghlzkyXFxGwuwwIMlgAF11VW8ap9V-zxx8uqqYcoFJBBMXKoARVooCeTpEBORj3RY1HB4mFgzuJwq-z2jmCJ7jqnk5XhByR9Iy54LOeGcTAQWKkZyqcATPAh8Tgr7vXYh4z9OjR9bf2tvpqHx3F903w-6H5ow2vaqbdsPl-6MTjvylhzq2w39dWh91zc8osZOIw54xr4bTp0mh24i79D2Z92pi6bFcDzF-L6ccpkbrnWj8Yy39jw00ViK9dgHMbJ1Cl-OgwpfFeJKZcplMcnRrnVvTRl30pPd5qouOnKV-pctLPFY-x9U9wZfV-GFfxP89_0_KPlmK3EMImvddbwrvM8sYbMnlxeF9538eT2tJf8kJwrvR4Wq8P7Z4n3EPwEAAP__gP_LlQ">