[Toybox] [PATCH] scripts/make.sh: don't call out to sed in getglobals()
Rob Landley
rob at landley.net
Sun Mar 5 13:00:27 PST 2023
On 3/4/23 14:09, enh via Toybox wrote:
> Current macOS does have basename -s, and $(basename -s .c $i) works
> fine too, but using bash's built-in regular expression support
> shaves almost 2s off the total clean build time.
Indeed, but I'm close to getting the build to run under toysh, but haven't
opened the array variable can of worms yet. (Which is essentially another
subsystem, since it touches so many things.) So merging this moves the goalposts
on me quite a bit again. Not against it in principle, just... inconvenient timing.
I rewrote it to NAME=${i##*/} NAME=${NAME%\.c} which works for me and I'm
assuming fixes the speed problem for you?
> Config.in and globals.h are still where all the time goes before
> the actual build starts, but 1-2s off 14s
Fourteen seconds?
$ time make clean defconfig true
cleaned
cc -o kconfig/conf kconfig/conf.c kconfig/zconf.tab.c -DKBUILD_NO_NLS=1 \
-DPROJECT_NAME=\"ToyBox\"
scripts/genconfig.sh
kconfig/conf -D /dev/null Config.in > /dev/null
scripts/single.sh true
true:Library probe
generated/{Config.in,newtoys.h,flags.h,globals.h,tags.h,help.h}
Compile true
..................
real 0m4.342s
user 0m5.923s
sys 0m1.199s
My laptop is 10 years old and the actual build starts in 5 seconds here. I'm
guessing this is mac being weird again?
> seems like a worthwhile
> saving on a "MacBookPro18,1", especially if we're not using basename
> anyway (which would be clearer than any regex option, and make it
> harder to justify this).
Well, the comment "alas basename -s isn't in posix yet" may have something to do
with it, but I suspect it's more that the sed invocation was added in commit
b1aaba1fc817 in 2008 back when basename in ubuntu didn't have -s yet. (It was
added to coreutils in 2012. Chasing moving targets...)
Rob
More information about the Toybox
mailing list