[PATCH] D136536: [lld-macho] Don't sort map file entries by name

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 22 12:55:10 PDT 2022


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

ld64 emits them in address order but not in alphabetical order. This
sorting is particularly expensive for dead-stripped symbols (which don't
need to be sorted at all, unlike live symbols that need to be sorted by
address).

Timings for chromium_framework_less_dwarf (with the `-map` flag added to
the response file) on my 16-core Mac Pro:

             base           diff           difference (95% CI)
  sys_time   1.997 ± 0.038  2.004 ± 0.028  [  -0.6% ..   +1.3%]
  user_time  8.698 ± 0.085  8.167 ± 0.070  [  -6.6% ..   -5.6%]
  wall_time  7.965 ± 0.114  7.715 ± 0.347  [  -5.1% ..   -1.2%]
  samples    25             23


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136536

Files:
  lld/MachO/MapFile.cpp


Index: lld/MachO/MapFile.cpp
===================================================================
--- lld/MachO/MapFile.cpp
+++ lld/MachO/MapFile.cpp
@@ -72,13 +72,7 @@
         info.files.push_back(file);
     }
   parallelSort(info.liveSymbols.begin(), info.liveSymbols.end(),
-               [](Defined *a, Defined *b) {
-                 return a->getVA() != b->getVA() ? a->getVA() < b->getVA()
-                                                 : a->getName() < b->getName();
-               });
-  parallelSort(
-      info.deadSymbols.begin(), info.deadSymbols.end(),
-      [](Defined *a, Defined *b) { return a->getName() < b->getName(); });
+               [](Defined *a, Defined *b) { return a->getVA() < b->getVA(); });
   return info;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136536.469922.patch
Type: text/x-patch
Size: 752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221022/f150a4ad/attachment.bin>


More information about the llvm-commits mailing list