[PATCH] D114735: [lld][macho] Stop grouping symbols by sections in mapfile.

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 18:12:20 PST 2022


int3 added a comment.

So benchmarking instructions... first, download the zipfile in comment #1 on https://bugs.llvm.org/show_bug.cgi?id=48657 and unpack it into a `chromium_framework` directory. That will serve as our benchmark. Then install cbdr per the instructions here: https://github.com/asayers/cbdr/blob/master/cbdr.md

Now create two builds of LLD, before and after this change. Say the LLD binary before this change is at ~/before/ld64.lld and the one after the change is at ~/after/ld64.lld. Then run the following command from within `chromium_framework`:

  cbdr sample "base:~/before/ld64.lld @response.txt -map beforemap.txt" "diff:~/after/ld64.lld @response.txt -map aftermap.txt" --timeout=300s | tee results.csv | cbdr analyze -s 95

To reduce noise, close as many other processes as possible before kicking off the benchmark. If your readings are still very noisy, try increasing the timeout value in the benchmarking command to get a more precise confidence interval.

So the command above will measure the change in overall LLD runtime. However, since we are running `writeMapFile` in parallel with other linker work, we should be able to get a more precise estimate of perf improvement by measuring the change in the time it takes to run that function alone. We can collect & extract that data via the `--time-trace` flag:

  #-- bench.sh
  RESULT=$(~/${1}/ld64.lld @response.txt -map ${1}map.txt --time-trace-file=${1}trace.txt && cat ${1}trace.txt | python -m json.tool | grep '\"Write map file' -B1 | grep '[0-9]\+' -o)
  echo {\"time\":$RESULT}

I used the script as follows:

  cbdr sample --bench ~/bench.sh --timeout=300s -- before after

LMK if you have any issues getting this to work :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114735



More information about the llvm-commits mailing list