<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 6:49 PM, Stephen Checkoway <span dir="ltr"><<a href="mailto:s@pahtak.org" target="_blank">s@pahtak.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">MCObjectSymbolizer currently iterates through each symbol every time it is asked to tryAddingSymbolicOperand. With many symbols, this takes a very long time.<br>
</blockquote><div><br></div><div>I ran into an issue this summer where `llvm-objdump -symbolize` took like 10,000 times longer than without. Is this related to that?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
The attached patch iterates through the symbols the first time this is needed and puts them in a sorted vector. Subsequent lookups use std::upper_bound() to find the symbol in log(n) time.<br>
<br>
Without the patch, calling MCObjectDisassembler::buildModule(/* withCFG */ false) on an unstripped build of Chromium took more than 2 hours (which is when I gave up on it). With the patch, it takes 24 seconds.<br>
<br>
My particular build of Chromium has 474,222 symbols (as counted with nm chrome|wc -l) and is 2.1 GB.<br>
<br>
It is difficult to test the speedup with llvm-objdump because passing true for withCFG uses more than my available 32 GB of RAM when run on a 7.3 MB file and on smaller files, e.g., my 3 MB ninja binary, the difference in speed is in the noise. And even then, it's using about 6 GB of RAM.<br>
</blockquote><div><br></div><div>What command line for llvm-objdump uses 6GB of RAM on the ninja binary? That seems bug-worthy; the ninja executable is like <200K of code (the rest is debug info, which ninja builds with by default).</div>
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Stephen Checkoway<br>
<br>
<br>
</font></span><br><br>
<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>