[Toybox] toybox build first-world problems
enh
enh at google.com
Sat Mar 4 12:03:34 PST 2023
i don't think the DASHN stuff is working right? it's particularly
noticeable on a MacBook (with 8 performance cores and 2 efficiency
cores), but i see it on my desktop too (with 128 cores).
with something like this:
```
diff --git a/scripts/make.sh b/scripts/make.sh
index b0c3d22a..6d484378 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -277,7 +277,7 @@ do
do_loudly $BUILD -c $i -o $OUT &
# ratelimit to $CPUS many parallel jobs, detecting errors
- [ $((++COUNT)) -ge $CPUS ] && { wait $DASHN; DONE=$?; : $((--COUNT)); }
+ [ $((++COUNT)) -ge $CPUS ] && { echo "waiting $DASHN count=$COUNT
cpus=$CPUS"; ps; wait $DASHN; DONE=$?; : $((--COUNT)); }
[ $DONE -ne 0 ] && break
done
```
you see that initially $CPUS jobs are started, but anything over that
is serialized. this is a lot less noticeable when you have 128 cores,
because that's "most of defconfig" anyway. but when you only [world's
tiniest violin] have 10 cores, it's really noticeable [even without
that patch] the first 10 dots appear instantaneously, but the
remaining ones appear one-by-one [which is what made me ask ps "what's
actually going on?"]. there's basically just one compile job running
at any given time after the first batch on the Mac. it's not _quite_
serial though, because on the 128-core box i do see ~4 cc jobs at a
time after the initial 128 job goldrush.
so even if "macOS bash doesn't have -n so strict serialization is
expected after the first few jobs" is intended, i think there's wasted
build time on linux too. (this doesn't affect Android's build system,
of course, but this really stands out on a current Mac --- everything
_else_ is super fast on these machines, but toybox builds are
comically slow. and it looks odd on a 128 core linux box too, as it
screams out of the gate and then dribbles over the finish line :-) )
i'd poke deeper, but i don't even understand _why_ this is done in the
shell rather than in make (even if the shell generates the relevant
chunk of makefile), so i'm probably not the right person for it :-)
More information about the Toybox
mailing list