[PATCH] D104346: [lld][MachO] Sort symbols in parallel in -map

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 22:01:57 PDT 2021


int3 added a comment.

> Trying to produce one

We often use this Chromium build snapshot as a benchmark: https://drive.google.com/file/d/1j6_f55jX1WYjwrDSmQYbr_X043mLG9L2/view?usp=sharing

Download and unpack it, then you can run the link command like so `ld64.lld -map mapoutputfile @response.txt`

You'll want to run it a number of times. This is the script that I usually use:

  (base) lld/MachO: cat `which bench.sh`
  #!/bin/bash
  set -x
  echo "warming up..." >&2
  $@
  for i in {1..20}
  do
    /usr/bin/time -p $@ 2>&1 | grep "^real " | awk '{print $2}'
  done

I typically use that script to generate two sets of measurements, one before and one after this diff is applied. Then I compare the results using https://github.com/codahale/ministat. The commit message in D103979 <https://reviews.llvm.org/D103979> is an example of the result.



================
Comment at: lld/MachO/MapFile.cpp:55
   for (auto &it : ret)
-    llvm::stable_sort(it.second, [](Defined *a, Defined *b) {
-      return a->getVA() < b->getVA();
-    });
+    llvm::parallel::detail::parallel_sort(
+        it.second.begin(), it.second.end(), [](Defined *a, Defined *b) {
----------------
I think this can just be `llvm::parallel_sort` (and with the `using namespace llvm` above, we don't even need the llvm::). Stuff under `detail` namespaces shouldn't be used directly -- they're implementation details


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104346



More information about the llvm-commits mailing list