On Mon, Aug 15, 2022 at 9:25 AM Owen Rafferty <owen@xxxxxxxxxxxxxxxx> wrote: > > On 22/08/14 09:23AM, Masahiro Yamada wrote: > > On Fri, Aug 12, 2022 at 11:36 PM Owen Rafferty <owen@xxxxxxxxxxxxxxxx> wrote: > > > > > > Remove the bash build dependency for those who otherwise do not > > > have it installed. This also provides a significant speedup: > > > > > > $ make defconfig > > > $ make yes2modconfig > > > > > > ... > > > > > > $ find . -name "*.o" | grep -v vmlinux | wc > > > 3169 3169 89615 > > > $ export NM=nm > > > $ time sh -c 'find . -name "*.o" | grep -v vmlinux | xargs -n1 > > > ./scripts/check-local-export' > > > > > > Without patch: > > > 0m15.90s real 0m12.17s user 0m05.28s system > > > > > > With patch: > > > dash + nawk > > > 0m02.16s real 0m02.92s user 0m00.34s system > > > > > > dash + busybox awk > > > 0m02.36s real 0m03.36s user 0m00.34s system > > > > > > dash + gawk > > > 0m02.07s real 0m03.26s user 0m00.32s system > > > > > > bash + gawk > > > 0m03.55s real 0m05.00s user 0m00.54s system > > > > > > Signed-off-by: Owen Rafferty <owen@xxxxxxxxxxxxxxxx> > > > > > > > > > > How did you get those small numbers? > > > > > > The script invokes ${NM} internally, > > so it is impossible to become faster than nm. > > > > For me, it takes 55 sec just for running nm. > > > > > > > > > > $ find . -name "*.o" | wc > > 3191 3191 90085 > > > > $ time sh -c 'find . -name "*.o" | grep -v vmlinux | xargs -n1 nm >/dev/null' > > nm: ./arch/x86/entry/vdso/vdso32/note.o: no symbols > > nm: ./arch/x86/entry/vdso/vdso-note.o: no symbols > > > > real 0m55.783s > > user 0m24.887s > > sys 0m30.905s > > > > I'm not exactly sure. I get compatible numbers with just nm. > > $ find . -name "*.o" | grep -v vmlinux | wc > 3169 3169 89615 > > $ time sh -c 'find . -name "*.o" | grep -v vmlinux | xargs -n1 nm' > 0m02.02s real 0m01.77s user 0m00.43s system > About the slowness of nm, it might depend on the GNU binutils version. I tried some versions in docker. On Ubuntu 18.04: $ nm -V | head -n1 GNU nm (GNU Binutils for Ubuntu) 2.30 $ time sh -c 'find . -name "*.o" | grep -v vmlinux | xargs -n1 nm >/dev/null' nm: ./arch/x86/entry/vdso/vdso-note.o: no symbols nm: ./arch/x86/entry/vdso/vdso32/note.o: no symbols real 0m2.694s user 0m2.201s sys 0m0.729s On Ubuntu 20.04: $ nm -V | head -n1 GNU nm (GNU Binutils for Ubuntu) 2.34 $ time sh -c 'find . -name "*.o" | grep -v vmlinux | xargs -n1 nm >/dev/null' nm: ./arch/x86/entry/vdso/vdso-note.o: no symbols nm: ./arch/x86/entry/vdso/vdso32/note.o: no symbols real 0m5.287s user 0m3.356s sys 0m2.035s On Ubuntu 22.04: $ nm -V | head -n1 GNU nm (GNU Binutils for Ubuntu) 2.38 $ time sh -c 'find . -name "*.o" | grep -v vmlinux | xargs -n1 nm >/dev/null' nm: ./arch/x86/entry/vdso/vdso-note.o: no symbols nm: ./arch/x86/entry/vdso/vdso32/note.o: no symbols real 0m37.107s user 0m14.121s sys 0m23.229s So, 'nm' is progressively becoming slower and slower. With the recent nm, most of the time for running check-local-export is consumed for 'nm'. llvm-nm is a little faster, but it is still slow. -- Best Regards Masahiro Yamada