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

Benjamin Kramer benny.kra at googlemail.com
Tue Sep 8 11:52:23 PDT 2009


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: GetMainExecutable.patch
Type: application/octet-stream
Size: 908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090908/109ad3ba/attachment.obj>


More information about the llvm-commits mailing list