<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Great news. Try testing this same stuff after a "purge" (clear the file caches). The "purge" is not a great test, but it gives you a bit of an idea of how things would perform if nothing was in the file cache...<div><br></div><div>If things turn out the same as before, feel free to checkin the std::stable_sort fix.</div><div><br></div><div>Greg Clayton</div><div><br><div><div>On Jun 16, 2010, at 10:04 AM, Owen Anderson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">OK, I just performed these measurements on 64-bit 10.6, with both -Os and -O3 builds of lldb.  In both cases, std::sort was on the order of 50% slower than qsort_r:<br><br><font class="Apple-style-span" face="Courier">                   -Os      -O3<br>std::sort          0.118s   0.103s       <br>qsort_r            0.077s   0.078s</font><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica">However, here's the interesting part:</font></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><br></font></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier">std::stable_sort   0.051s   0.048s</font></font></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier"><br></font></font></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica">So, it looks like the symbol tables are already mostly sorted, and a simple insertion sort is able to "complete" the sort quickly.  FWIW, this would also be a good place to apply TimSort or some other heuristic sort.</font></font></font></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><br></font></font></font></font></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica">--Owen<br></font></font></font></font><br><br>On Jun 16, 2010, at 9:27 AM, Greg Clayton wrote:<br><br><blockquote type="cite">We start with "Sketch" from the /Developer/Expamples. It loads 91 shared libraries right off the bat, and if you then type:<br><br>(lldb) log timers enable<br>(lldb) breakpoint set --name main<br>(lldb) log timers disable<br><br>All of the symbol tables will be pulled in, and it will dump the timing information. <br><br>You will first need to add a scoped timer to the top of:<br><br>Symtab::SortSymbolIndexesByValue()<br><br>The easiest way is:<br><br>    Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__);<br><br>Then you should see an entry in the timer dump for Symtab::SortSymbolIndexesByValue when the "log timers disable" is run with a total time.<br><br></blockquote><br><br></div></div></blockquote></div><br></div></body></html>