[llvm-bugs] [Bug 50404] New: `llvm-objcopy --keep-symbols` is slower than GNU equivalent

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 19 08:52:07 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50404

            Bug ID: 50404
           Summary: `llvm-objcopy --keep-symbols` is slower than GNU
                    equivalent
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-objcopy/strip
          Assignee: unassignedbugs at nondot.org
          Reporter: brian.cain at gmail.com
                CC: alexander.v.shaposhnikov at gmail.com,
                    jake.h.ehrlich at gmail.com,
                    jh7370.2008 at my.bristol.ac.uk,
                    llvm-bugs at lists.llvm.org, rupprecht at google.com

While investigating an issue with android build performance, I found that
llvm-objcopy performance is far from parity with GNU objcopy for the
"--keep-symbols" case, when the keep symbols list is very large.

I can see that llvm objcopy creates a list of NameOrPattern-s to represent the
keep symbol list, but it looks like it exhaustively compares each symbol in the
keep list against each symbol in the input file.  Not sure what GNU objcopy
does but merging the non-pattern symbol names into a sorted list would make
searching much faster.

Below is a script to reproduce the problem and its output.  The test case below
demonstrates a significant performance difference.  The android build failure
case reported had a shared obj with ~700k symbols and the keep list was ~300k
symbols and it took ~8 minutes to execute.

~~~

Here's the output I get when I run it on ToT-within-last-week-or-so:

$ PATH=$PWD/bin:$PATH ../../tmp/qt66370/32/objcopy_perf.sh
creating init file
creating obj file
creating shared obj file
ld.lld: warning: lld uses blx instruction, no object with architecture
supporting feature detected
performing llvm objcopy
12.34user 0.00system 0:12.35elapsed 99%CPU (0avgtext+0avgdata
20228maxresident)k
0inputs+2288outputs (0major+3815minor)pagefaults 0swaps
performing GNU objcopy
0.03user 0.00system 0:00.04elapsed 97%CPU (0avgtext+0avgdata 20396maxresident)k
0inputs+2288outputs (0major+5895minor)pagefaults 0swaps

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210519/7c830025/attachment.html>


More information about the llvm-bugs mailing list