<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 16, 2017 at 1:14 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">One note is that generally printf-like formatting ends up being much slower than custom formatting that doesn't have to go through a varargs call etc. Not sure if it is slower/faster in this case though.<div><br></div><div>The reason I mention this is that there are users at PlayStation that have this feature on *for all links* and it actually consumes a pretty significant amount of time IIRC (something like 25% of the link maybe?).</div><div><br></div><div>Not sure if this is worth worrying about, but just an FYI for a surprising fact!</div></div></blockquote><div><br></div><div>When linking clang, this feature actually takes 80% of the link time, so it is extremely slow. That's not because of the use of printf though. I think that's because (1) string-nizing objects are generally slow, (2) demangling symbols is particularly time consuming, and (3) other parts of LLD are pretty fast (so the ratio of the time spent for this feature is larger than for slower linkers). I haven't tried to optimize it, but I wouldn't be surprised if we can't make this significantly faster.</div><div><br></div><div>If this needs to be much faster, maybe we should parallelize it to improve latency.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span class="HOEnZb"><font color="#888888"><br><div><br></div><div>-- Sean Silva</div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 14, 2017 at 5:11 PM, Rui Ueyama via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ruiu<br>
Date: Sat Jan 14 19:11:47 2017<br>
New Revision: 292042<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=292042&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=292042&view=rev</a><br>
Log:<br>
Simplify string output. NFC.<br>
<br>
Modified:<br>
    lld/trunk/COFF/MapFile.cpp<br>
    lld/trunk/ELF/MapFile.cpp<br>
<br>
Modified: lld/trunk/COFF/MapFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/MapFile.cpp?rev=292042&r1=292041&r2=292042&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/COFF/MapFile.<wbr>cpp?rev=292042&r1=292041&r2=<wbr>292042&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/COFF/MapFile.cpp (original)<br>
+++ lld/trunk/COFF/MapFile.cpp Sat Jan 14 19:11:47 2017<br>
@@ -36,9 +36,7 @@ using namespace lld::coff;<br>
<br>
 static void writeOutSecLine(raw_fd_ostream &OS, uint64_t Address, uint64_t Size,<br>
                             uint64_t Align, StringRef Name) {<br>
-  OS << format_hex_no_prefix(Address, 8) << ' '<br>
-     << format_hex_no_prefix(Size, 8) << ' ' << format("%5x ", Align)<br>
-     << left_justify(Name, 7);<br>
+  OS << format("%08x %08x %5x ", Address, Size, Align) << left_justify(Name, 7);<br>
 }<br>
<br>
 static void writeInSecLine(raw_fd_ostream &OS, uint64_t Address, uint64_t Size,<br>
@@ -89,9 +87,7 @@ static void writeSectionChunk(raw_fd_ost<br>
<br>
 static void writeMapFile2(raw_fd_ostream &OS,<br>
                           ArrayRef<OutputSection *> OutputSections) {<br>
-  OS << left_justify("Address", 8) << ' ' << left_justify("Size", 8)<br>
-     << ' ' << left_justify("Align", 5) << ' ' << left_justify("Out", 7) << ' '<br>
-     << left_justify("In", 7) << ' ' << left_justify("File", 7) << " Symbol\n";<br>
+  OS << "Address  Size     Align Out     In      File    Symbol\n";<br>
<br>
   for (OutputSection *Sec : OutputSections) {<br>
     uint32_t VA = Sec->getRVA();<br>
<br>
Modified: lld/trunk/ELF/MapFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=292042&r1=292041&r2=292042&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/MapFile.cp<wbr>p?rev=292042&r1=292041&r2=2920<wbr>42&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/MapFile.cpp (original)<br>
+++ lld/trunk/ELF/MapFile.cpp Sat Jan 14 19:11:47 2017<br>
@@ -35,8 +35,7 @@ using namespace lld::elf;<br>
<br>
 static void writeOutSecLine(raw_fd_ostream &OS, int Width, uint64_t Address,<br>
                             uint64_t Size, uint64_t Align, StringRef Name) {<br>
-  OS << format_hex_no_prefix(Address, Width) << ' '<br>
-     << format_hex_no_prefix(Size, Width) << ' ' << format("%5x ", Align)<br>
+  OS << format("%0*x %0*x %5x ", Width, Address, Width, Size, Align)<br>
      << left_justify(Name, 7);<br>
 }<br>
<br>
@@ -100,8 +99,7 @@ static void writeMapFile2(raw_fd_ostream<br>
   int Width = ELFT::Is64Bits ? 16 : 8;<br>
<br>
   OS << left_justify("Address", Width) << ' ' << left_justify("Size", Width)<br>
-     << ' ' << left_justify("Align", 5) << ' ' << left_justify("Out", 7) << ' '<br>
-     << left_justify("In", 7) << ' ' << left_justify("File", 7) << " Symbol\n";<br>
+     << " Align Out     In      File    Symbol\n";<br>
<br>
   for (OutputSectionBase *Sec : OutputSections) {<br>
     writeOutSecLine(OS, Width, Sec->Addr, Sec->Size, Sec->Addralign,<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>