<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 8:02 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"><div class="im"><br>
On Oct 14, 2013, at 7:59 PM, Sean Silva <<a href="mailto:silvas@purdue.edu">silvas@purdue.edu</a>> wrote:<br>
<br>
> On Mon, Oct 14, 2013 at 6:49 PM, Stephen Checkoway <<a href="mailto:s@pahtak.org">s@pahtak.org</a>> wrote:<br>
><br>
>> MCObjectSymbolizer currently iterates through each symbol every time it is<br>
>> asked to tryAddingSymbolicOperand. With many symbols, this takes a very<br>
>> long time.<br>
>><br>
><br>
> I ran into an issue this summer where `llvm-objdump -symbolize` took like<br>
> 10,000 times longer than without. Is this related to that?<br>
<br>
</div>I was using -symbolize.<br>
<div class="im"><br>
>> The attached patch iterates through the symbols the first time this is<br>
>> needed and puts them in a sorted vector. Subsequent lookups use<br>
>> std::upper_bound() to find the symbol in log(n) time.<br>
>><br>
>> Without the patch, calling MCObjectDisassembler::buildModule(/* withCFG */<br>
>> false) on an unstripped build of Chromium took more than 2 hours (which is<br>
>> 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<br>
>> chrome|wc -l) and is 2.1 GB.<br>
>><br>
>> It is difficult to test the speedup with llvm-objdump because passing true<br>
>> for withCFG uses more than my available 32 GB of RAM when run on a 7.3 MB<br>
>> file and on smaller files, e.g., my 3 MB ninja binary, the difference in<br>
>> speed is in the noise. And even then, it's using about 6 GB of RAM.<br>
>><br>
><br>
> What command line for llvm-objdump uses 6GB of RAM on the ninja binary?<br>
> That seems bug-worthy; the ninja executable is like <200K of code (the rest<br>
> is debug info, which ninja builds with by default).<br>
<br>
<br>
</div>llvm-objdump -disassemble -cfg -symbolize ninja<br></blockquote><div><br></div><div>Holy crap! Have you investigated what is using so much memory?</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>
<br>
</font></span></blockquote></div><br></div></div>