<div dir="ltr">gold's -stats is probably useful for gold developers but I think that is not designed for others to benchmark the program.<div><br></div><div>Timing reports reported by the program itself can be inaccurate or not suitable for comparison. For example, it might not include time for startup and shutdown. You don't know what timer they are using (there are many as you can see at <a href="https://linux.die.net/man/3/clock_gettime">https://linux.die.net/man/3/clock_gettime</a>) Or, more in general, if you want to compare program A and B, you usually want to use the same tool to measure and compare their performance numbers, instead of relying on each program's self status reports.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 21, 2017 at 1:17 AM, George Rimar <span dir="ltr"><<a href="mailto:grimar@accesssoftek.com" target="_blank">grimar@accesssoftek.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">>> As to the Phoronix benchmark results, I tried linking fftw as an example<br>
>> and got a different result. In my test, ld.bfd, ld.gold and ld.lld are all<br>
>> on par, and that is reasonable because compile time is the dominant factor<br>
>> of building fftw. In the Phoronix tests, LLD was slower than the GNU<br>
>> linkers when linking fftw, and I don't know why. The Phoronix tests<br>
>> measured the entire build time (as opposed to the time that the linker<br>
>> actually consumed), and it seems to me that that is too noisy. (Michael, if<br>
>> you are watching this, you probably want to measure only the time spent by<br>
>> the linker?)<br>
>><br>
><br>
>Unfortunately it is not very easy to test just the link time in a build (or<br>
>just the non-link time). I have had to do this in the past and there is no<br>
>universally applicable solution, so I wouldn't expect Phoronix (which does<br>
>high-level black-box testing) to do this.<br>
<br>
</span>FWIW both gold/bfd support -stats command line option. Example of output:<br>
<br>
ld.bfd -stats lib/libLLVMMCParser.a -o ooo<br>
ld.bfd: warning: cannot find entry symbol _start; not setting start address<br>
ld.bfd: total time in link: 0.000000<br>
ld.bfd: data size 274432<br>
<br>
ld.gold -stats lib/libLLVMMCParser.a -o ooo<br>
ld.gold: initial tasks run time: (user: 0.000000 sys: 0.000000 wall: 0.000000)<br>
ld.gold: middle tasks run time: (user: 0.000000 sys: 0.000000 wall: 0.000000)<br>
ld.gold: final tasks run time: (user: 0.000000 sys: 0.000000 wall: 0.000000)<br>
ld.gold: total run time: (user: 0.000000 sys: 0.000000 wall: 0.000000)<br>
ld.gold: total space allocated by malloc: 606208 bytes<br>
ld.gold: total bytes mapped for read: 9509982<br>
ld.gold: maximum bytes mapped for read at one time: 9509982<br>
ld.gold: archive libraries: 1<br>
ld.gold: total archive members: 9<br>
ld.gold: loaded archive members: 0<br>
ld.gold: lib groups: 0<br>
ld.gold: total lib groups members: 0<br>
ld.gold: loaded lib groups members: 0<br>
ld.gold: output file size: 648 bytes<br>
ld.gold: symbol table entries: 3; buckets: 1031<br>
ld.gold: symbol table stringpool entries: 3; buckets: 1031<br>
ld.gold: symbol table stringpool Stringdata structures: 1<br>
ld.gold: section name pool entries: 4; buckets: 11<br>
ld.gold: section name pool Stringdata structures: 1<br>
ld.gold: output symbol name pool entries: 3; buckets: 5<br>
ld.gold: output symbol name pool Stringdata structures: 0<br>
ld.gold: dynamic name pool entries: 0; buckets: 2<br>
ld.gold: dynamic name pool Stringdata structures: 0<br>
ld.gold: total free lists: 0<br>
ld.gold: total free list nodes: 0<br>
ld.gold: calls to Free_list::remove: 0<br>
ld.gold: nodes visited: 0<br>
ld.gold: calls to Free_list::allocate: 0<br>
ld.gold: nodes visited: 0<br>
<br>
Looks it is possible to see total run time for them.<br>
<div class="HOEnZb"><div class="h5"><br>
>That being said, like you<br>
>mentioned, a small part of the overall (clean / full-rebuild) build time is<br>
>spent linking for most projects, so I agree that any significant changes in<br>
>the numbers by switching linkers is suspect (especially between LLD and<br>
>gold; I've seen BFD be "crazy slow" sometimes).<br>
><br>
>The main thing I can think of is that, for example, if the projects' build<br>
>system detects if the compiler/linker supports LTO (by actually properly<br>
>testing it, not like stockfish that pretty much hardcodes it, causing the<br>
>LLD build to fail in this batch of tests), then the LLD links might end up<br>
>with non-LTO builds and the gold/BFD builds could be doing LTO.<br>
><br>
>-- Sean Silva<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">George.<br>
</font></span></blockquote></div><br></div>