[llvm-commits] [PATCH] Make Path::GetMainExecutable faster on OSX

Daniel Dunbar daniel at zuster.org
Tue Sep 8 14:58:11 PDT 2009


Wow, nice catch -- I've known something was wrong because of the
amount of system time it consumes, but hadn't dug in. This makes your
patch an even bigger win w/ more threads, its almost 50% faster for
me.

Looking at the code now I'm wondering if it is even right that
clang-cc uses the main executable path to resolve headers. I think
this change got made to accommodate symlinked binaries, but I'm not
sure that "GetMainExecutablePath" is really the right way to find
this. Chris?

 - Daniel

On Tue, Sep 8, 2009 at 11:52 AM, Benjamin
Kramer<benny.kra at googlemail.com> wrote:
> Playing around with shark shows that much of the startup time of clang-cc is
> spent in dladdr looking for the executable path. There is another dyld API
> called _NSGetExecutablePath which does the same thing much faster. The
> function is available since 10.2 and documented in "man 3 dyld" (I don't
> know why it has a leading underscore though).
>
> benchmark: clang testsuite on my 2007 macbook pro (debug build, best of 3
> runs)
>
> dladdr:
> --- Running clang tests for i686-apple-darwin10.0.0 ---
> Testing Time: 57.76s
>
> _NSGetExecutablePath:
> --- Running clang tests for i686-apple-darwin10.0.0 ---
> Testing Time: 48.71s
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>



More information about the llvm-commits mailing list