[PATCH] D121006: Speedup dsymutil when working with big project.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 12:27:00 PST 2022


JDevlieghere added a comment.

This only becomes a problem when you have a huge number of public symbols. I bet the majority of these symbols are weak exports from linkeonce_odr functions. Could you change your project to use something like `-fvisibility=hidden` to hide symbols by default? Doing that has the added benefit of saving the dynamic loader a bunch of work and improving launch time.

I ran some benchmarks on `clang`, and indeed, this patch actually slows things down:

Baseline:

  Time (mean ± σ):     86.446 s ±  0.274 s    [User: 124.955 s, System: 4.702 s]
  Range (min … max):   86.075 s … 86.932 s    10 runs  

With this patch:

  Time (mean ± σ):     88.012 s ±  0.502 s    [User: 127.594 s, System: 5.156 s]
  Range (min … max):   87.397 s … 89.001 s    10 runs



================
Comment at: llvm/lib/Support/StringRef.cpp:199-209
 size_t StringRef::rfind(StringRef Str) const {
   size_t N = Str.size();
   if (N > Length)
     return npos;
   for (size_t i = Length - N + 1, e = 0; i != e;) {
     --i;
+    if (*(Data + i) == *(Str.Data) && substr(i, N).equals(Str))
----------------
I'm not sure I understand what this is trying to achieve. Changes to support should go in a separate patch with its own description/motivation and unit test coverage. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121006/new/

https://reviews.llvm.org/D121006



More information about the llvm-commits mailing list