[Toybox] [PATCH] scripts/make.sh: don't call out to sed in getglobals()
enh
enh at google.com
Mon Mar 6 10:46:17 PST 2023
On Sun, Mar 5, 2023 at 12:46 PM Rob Landley <rob at landley.net> wrote:
>
> 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?
yeah, that works on macOS too. thanks!
> > Config.in and globals.h are still where all the time goes before
> > the actual build starts, but 1-2s off 14s
>
> Fourteen seconds?
(for the _total_ configure+build.)
> $ 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?
to be fair, i don't have a non-google-owned mac, so i've no idea
whether this is entirely darwin's fault, entirely the fault of some
security software, or a mixture of the two. but, yes, it does seem
like my gnu sed binary starts and/or runs slow. (the mac sed doesn't
work for toybox's fancy uses.)
> > 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...)
ah, that makes a lot more sense! after all, hardly anything is in posix :-)
> Rob
More information about the Toybox
mailing list