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

    <tr>
        <th>Summary</th>
        <td>
            LLVM time trace demangling resulted in a significant (10%?) compile time regression
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm
      </td>
    </tr>

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

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

<pre>
    In PR #87626 / 0fa20c55b58deb94090985a5c5ffda4d5ceb3cd1 LLVM began demangling function names when tracing optimization passes. Demangling C++ symbols can be really expensive, and on first glance, it seems we redo this work every time we remangle the same original symbol. There may be some opportunity to improve performance here:
* Can we memoize the names? Storing the demangled names once and keying them on `Function*` might speed things up, and it could also reduce memory usage, given that .symtab can often end up being a significant fraction of final object file size (20+%).
* Are we being lazy enough? Are we sure we are defering the work of demangling the name until *after* we've confirmed that we time trace scope passes the minimum time trace granularity?

CC @jamieschmeiser @Trass3r
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxclM-O4zYMxp9GuRAbKHLs2AcfMhkYKLAFinbROy3Ttnb0xxDlTD1PX8jJdga9RIhEkfx-_GRkNpMnakX5IsrXA65pDrGN_u3Qh2Frf_Pwx58gVFFfKlWBUB3IEZXUZdmX9UB9c5aNbOoSS12O44DnodTUF3o4wffvf_8OPU3oYSCHfrLGTzCuXicTPHh0xPA-k4cUUeezsCTjzAfu5wsyEx_h9fPuTagXoV6AN9cHy6DRQ08QCa3dgP5ZyLO5k1A3QD9A8DCayAkmi17v2yYBEzmG93xtCJBmw_Ae4hvQneIGyTh6HO5VCdJMwOgIQjST8Wif1Y_wY6ZI4HDLPXDIIcsSYlq9SRukAMYtMdwJFopjiC73APmOKK5Cvgp5FeoKN_S5niMXzMej3E5GFB38lULMuvPmEyENT3AhZ8sq32h7xrisWFSyeyIW6ioqCc5McwJeiIYs108M6_KLkUmgw2oHQMshI1n1o5m4wco47dQmc89TmjHBkTeXsN_RhzGRB_IDrAv0lLtAyH4yo9HoE4wRH7MOI4w7u9D_JJ1gNJaAs16haiX3sZZCNcdPLte4z-GR1uLHBuTDOs2Zy_OM18eKMeMZ6T9W-zzD-NV2v7jC6pOxINQVx0QxV3onoS53Ah38aKLbKWHKiXczZHMSsA4LPT25J3PGG7e6rzFTRL9ajCZtouieUvbf2w3EWf5EZ4j17MgwxbzzIyJzEQ9DWwxN0eCB2tNFqeZyKc_VYW7rsz4hUk9N1ZzqUQ8ljQXpvipPzaVWw8G0SqqzrGWlZKlUdayxOqPse3nui6EuKnGW5NDYo7V3dwxxOhjmldqTVEqpg8WeLO-vX6kcIpTK34HY5j_f-nVicZbWcOLPDMkkS-3-vL-o_wI7Eq820QDG_88RQtUnmWdddEI1oINbshX2NJGmSMwm-MMabTuntHB-KqoTqptMmtf-qIMTqns0ui_flhiypYTqdmEsVPfUdm_VvwEAAP__JlikGQ">