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

C-凡 via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 4 17:09:20 PST 2022


C-_-fan added inline comments.


================
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))
----------------
JDevlieghere wrote:
> 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. 
Thank you for your review and comment.

In profile results, `rfind` method takes a large proportion of time, because `substr(I, N)` is slow;

If `substr(I, N)` equal to `Str`,  character at `(Data+ I)` should be equal to the first character of Str.


================
Comment at: llvm/tools/dsymutil/MachODebugMapParser.cpp:58
+  /// `getMainBinarySymbolNames`;
+  std::unordered_map<uint64_t, std::vector<StringRef>>
+      MainBinaryAddresses2NamesMap;
----------------
lebedev.ri wrote:
> `std::unordered_map` has bad performance characteristics.
> Does it help if this is instead a SmallDenseMap of SmallVector's? 
Thank you for your review and comment, I'll update and test later.


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

https://reviews.llvm.org/D121006



More information about the llvm-commits mailing list