<div dir="ltr"><div><div>Are you saying that these "find something in a directory that doesn't exist" steps are taking a majority of the difference between 30 and 100 seconds? That does seem very unlikely to me, as `stat` in Linux/Unix is a fairly well optimised function, and a lot of caching is done to ensure that it doesn't take much time.<br><br></div>I'm not sure what the difference is, and nor what project you are working on, but I doubt the searching through various paths for shared libraries is the big problem.<br><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 February 2016 at 10:41, Oza, Hiral via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@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">
<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div>
<p class="MsoNormal">Greetings!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Sample program:<u></u><u></u></p>
<p class="MsoNormal">int main(int argc, char **argv)<u></u><u></u></p>
<p class="MsoNormal">{<u></u><u></u></p>
<p class="MsoNormal"> int myLocal=0xAA;<u></u><u></u></p>
<p class="MsoNormal"> return 0;<u></u><u></u></p>
<p class="MsoNormal">}<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Command: clang t.c –o a.o –c<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">With above simple program we are observing that clang is stat-ing and trying to open various files from lib/tls location. Eventually all calls to “lib/tls” leads to ENOENT (No such file or directory)!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><sample_strace><u></u><u></u></p>
<p class="MsoNormal">open("path/lib/tls/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)<u></u><u></u></p>
<p class="MsoNormal">…<u></u><u></u></p>
<p class="MsoNormal">open("path/lib/tls/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)<u></u><u></u></p>
<p class="MsoNormal">…<u></u><u></u></p>
<p class="MsoNormal"></sample_strace><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The same behavior is not observed with GCC. With gcc we could build above sample program under 30 seconds while it takes more than 100 seconds when using clang!!!<u></u><u></u></p>
<p class="MsoNormal">Any pointer on how to reduce unnecessary stat/open is appreciated.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">My local installation paths are…<u></u><u></u></p>
<p class="MsoNormal"> somepath/gcc-4.9.x/{bin,lib}<u></u><u></u></p>
<p class="MsoNormal"> somepath/llvm-3.7.1/{bin,lib}<u></u><u></u></p>
<p class="MsoNormal"> somepath/{bin,lib}<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In above installation path we don’t have “tls” directory.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">In this regards I have following questions…<u></u><u></u></p>
<p class="MsoNormal">- We are not seeing present of “tls” directory under “somepath/llvm-3.7.1/{bin,lib}” – is anything missing in our installation?<u></u><u></u></p>
<p class="MsoNormal">- Why clang refers to “lib/tls”?<u></u><u></u></p>
<p class="MsoNormal">- Why clang refers to “lib/x86_64” ? And why not just using “lib/”<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thank you in advance for your help.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Regards,<u></u><u></u></p>
<p class="MsoNormal">-Hiral<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>