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

    <tr>
        <th>Summary</th>
        <td>
            [BOLT] Evaluate and speedup discoverFileObjects
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            help wanted,
            good first issue,
            BOLT
      </td>
    </tr>

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

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

<pre>
    Operations with symbols such as name lookup are expensive and some binaries have millions of symbols, so it makes sense to try to reduce the symbol-related overheads.

Measure how much the following cost and refactor/eliminate:
1. Checks for symbol name being equal to __asan_init and __llvm_coverage_mapping for every single symbol: https://github.com/llvm/llvm-project/blob/a1423ba4278775472523fed074de6dbdfd01898a/bolt/lib/Rewrite/RewriteInstance.cpp#L824-L837
2. FileName set for every local function symbol (with O(1M) for large binaries) while we can instead use file symbol lookup with O(log N_Syms) cost and FileSyms memory cost https://github.com/llvm/llvm-project/pull/89088
3. Merge iteration over two loops over symbols into one: https://github.com/llvm/llvm-project/blob/a1423ba4278775472523fed074de6dbdfd01898a/bolt/lib/Rewrite/RewriteInstance.cpp#L824 and https://github.com/llvm/llvm-project/blob/a1423ba4278775472523fed074de6dbdfd01898a/bolt/lib/Rewrite/RewriteInstance.cpp#L876
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVMGOpDYQ_RpzKQ0CAw194LA7E6RIMztSknurwAU4Y2ziMt3pv49Md8_kure9YGzrPb_3XC5k1pMlakX1XVQvCW5hdr5F3FZ3Tnqnru37Sh6DdpbhosMMfF16Zxh4G2ZABosLgXHuY1sBPQH9u5JlfSZAq4DdQtBri14Tw4xngkUbs9O58UEm5DOwAx1gwQ9iYLJMEBwEf42DJ7UNBGGmO-LJk8FACtyZ_EyoOBXZi8i-3b5vhLx5gtldYIk6I3J0xriLthMMjsOuztOIQ3BeyI6MXrTFQKK4k-QpPM80fDCMzt_PvbntKbLQPxuaqO50QkZ70lbfWE8nY87LaYjacKLTgusaAZGGzuSvwNpO5uFFFN9gDmHleLLshOwmHeatTwe3CNlFrvvwtHr3Nw1ByK43rheyw7yURY-lrJu6rspaVrIYSWV1qeigejWqLG-ODUaEMxFodMT9QRevA339_W45oB0oHdZVyOK1keXTa1PUtyhkCp029COaZwr_c2LcgAbGzQ6xRB4pCdnstfIuZJO_CXncEQb99FUMcfUya0NwIRjQgrYcCBVsTDDqz3getfVJaNwEP05_Xped4vMuo8C4CAstzl9vGz-d67oZI2TXHLOmuXkvUnijKFyH-0PYiw7CxUVpK9-mj2ehbXDgLP2qt7pn9esJqw-Jagt1LI6YUJvXeVllTZEXydweZY8qqwgLmVeHGlVZNUhZVVZK9gc6JLqVmSyzsshkljeyScsejwNRXqqxGuSIosxoQW3S6Cp1fko080btMTsc8sRgT4b3DijlTGaFC9pASkgp5LOQcnJOwag9B9hxnxvf31__ipPqJfHtnli_TSzKzGgO_HVa0MHsLXYHVC_w2xnNhuHeIlcita2gNO8tIxbyex-D52Tzpv3py9pFspDd7u-_AAAA___DlvQj">