<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129315>129315</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] Optimize std::replace and std::replace_if
</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>
We might be able to use `std::find` to replace contiguous ranges, and `replace_if` might be able to use `find_if`. This might be worth it if `std::find_if` is unrolled, for example. Or maybe it'll be worse because `std::find_if` has more data dependency because of short-circuiting. But this should be investigated.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0ksmK3DAQhp9GvhRj7Grb3T74MAt9nUsgx0FL2a4gS0bLJJOnD-o4MyELCAS1fFW_9MsYeXFEk-gfRP9UyZxWHyZr2DtHlfLmbfpMsPGyJlAEUlmC5CFHAjE0MRlxuhen-5mdEUNTUoF2KzWB9i7xkn2OEKRbKAp8BOlM6TtqXnguTf-jF-jPkho-rRw_Cr_6kFbgBDz_tcYB5QjZBW8tmTJ49gHom9x2SzU8B9jkmyLgJPBs7YGMBIq0_Je2A7rKCJsPBEYmCYZ2coacfnvv8zPE1Yd0pznozIndUsNDTpDK_nH12Zoyjd0rxcSLTGTqykwnM55GWdHUnrvmfD6P3VCt02BapS9d08-Iw2UcT40h3c90OfdGj2QqnrDBvkG8YIt9N9TY4cWoRg2taXEYZ9E1tEm2tbWvW-3DUnGMmaYWx1PbV1YqsvH2-YiWlRb4cDso8FEg7hRmHzbpNJVY_1SFqZDuVF6i6BrLMcUPduJkb1b6DdU_wfOeeOPvBO9P-ssjxQ5_Bl94rnKw05rSHksGrwKvC6c1q1r7TeC1DDyuuz34L6STwOtNWRR4PcS9TvgjAAD__72_7dk">