[Toybox] [landley/toybox] Release notes for 0.8.10 (cbc3e2c)

enh enh at google.com
Tue Aug 1 16:55:38 PDT 2023


On Tue, Aug 1, 2023 at 9:58 AM Rob Landley <rob at landley.net> wrote:
>
> I really hate having long discussions in github per-line comments to merged
> commits, because nobody will ever be able to _find_ them again six months from
> now if that history needs to be referenced.
>
> Continuing from:
>
>   https://github.com/landley/toybox/commit/cbc3e2c9889e#r123308704
>
> On 8/1/23 09:50, enh-google wrote:
> > yeah, but (a) gsed isn't part of macOS (it's from homebrew) and (b) since that's
> > actually a fairly new sed, as far as we know, /sed/ isn't the point at all ---
> > it's just that process launching is slow and (c) because we don't have a second
> > witness, as far as we know, it's just /my/ mac that's slow anyway.
>
> The second witness is Zach van Rijn gave me ssh access to:

ah, fair enough. i sit corrected.

>   __  __                        _       _   __  __ _
>  |  \/  | __ _  ___   _ __ ___ (_)_ __ (_) |  \/  / |
>  | |\/| |/ _` |/ __| | '_ ` _ \| | '_ \| | | |\/| | |
>  | |  | | (_| | (__  | | | | | | | | | | | | |  | | |
>  |_|  |_|\__,_|\___| |_| |_| |_|_|_| |_|_| |_|  |_|_|
>                                 ___  ____
>     _     _ __ ___   __ _  ___ / _ \/ ___|  Welcome to Darwin on
>   _| |_  | '_ ` _ \ / _` |/ __| | | \___ \  Apple Silicon (16GB)
>  |_   _| | | | | | | (_| | (__| |_| |___) |
>    |_|   |_| |_| |_|\__,_|\___|\___/|____/      2020 M1 Mac Mini
>
>  Hardware donated, hosted,                   Report issues here:
>  and managed by Adélie Linux.                      zv.io/contact
>
> I was guessing that the homebrew launch plumbing is a latency spike comparable
> with cygwin (for similar reasons: gnu duct-taped to non-gnu), but I hadn't dug
> nontrivially into it because even _with_ homebrew:
>
>   $ date +%s.%N
>   1690907598.N
>
> That said, looking again:
>
>   $ ./toybox date +%s.%N; gsed 2>/dev/null; ./toybox date +%s.%N
>   1690907813.326507000
>   1690907813.341453000
>   $ ./toybox date +%s.%N; sed </dev/null 2>/dev/null; ./toybox date +%s.%N
>   1690907834.689830000
>   1690907834.700861000
>   $ ./toybox date +%s.%N; ./toybox date +%s.%N
>   1690907949.490777000
>   1690907949.497742000
>
> It's not _that_ bad? 7 ms to do basically nothing...
>
>   $ ./toybox date +%s.%N; false; false; false; ./toybox date +%s.%N
>   1690908392.773238000
>   1690908392.781617000
>   $ ./toybox date +%s.%N; /usr/bin/false; /usr/bin/false; /usr/bin/false;
> ./toybox date +%s.%N
>   1690908440.248034000
>   1690908440.271217000
>
> Toybox date isn't noticeably slower than launching "false" (shell builtin is
> basically free). So maybe the problem is that MacOS is slow at launching ANY
> binary? (Blame the mach-o plumbing? 7 ms on one of the new fire-breathing M1
> chips is presumably a bit longer on an old laptop. We also didn't ask gsed to
> _do_ anything, I dunno if there's lazy binding and such on mac pulling in more
> shared libraries if you actually exercise code paths...)

yeah, i'm not keen to throw any stones, being partially/mostly
responsible for having always resolved Android's "lower RSS/higher
performance in app zygote children, or quicker startup for
/bin/false?" trade-offs in favor of the former. but, yes, it's kind of
outstanding that an otherwise ridiculously fast laptop should be
noticeably slow here compared to _much_ older/worse hardware.

> The </dev/null above is because macos sed run with no arguments acts as "cat".
> I'm not sure why? Nothing else seems to...
>
>   $ echo hello world | sed
>   hello world
>   $ echo hello world | awk
>   usage: awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
>   $ echo hello world | tr
>   usage: tr [-Ccsu] string1 string2
>          tr [-Ccu] -d string1
>          tr [-Ccu] -s string1
>          tr [-Ccu] -ds string1 string2
>   $ echo hello world | gsed 2>&1 | wc
>         41     207    1797
>
> > i think either of just s/their// or s/their gsed/gsed on macOS/ would be
> > accurate and fair, but the current wording is quite misleading (or at least,
> > "doesn't accurately say what we /know/ to be true").
>
> The new one's faster. It goes to 11. I'm happy to admit the old slowness was
> bypassed (by staying within bash) rather than thoroughly root caused...

you'd actually root caused it further than i'd realized ... i still
think "their gsed" is a little unfair/misleading, but now i'm more
confused about who exactly it's unfair to --- homebrew or darwin :-)

(and the fact that there's their old strace alternative [bsd truss] is
long gone, and their new one [dtrace-based dtruss] never seems to work
for me means i don't even know where to start looking. things like
this [including mach-o vs elf] are the reasons why i haven't bought
one of these for myself. though i can build toybox quicker in an
ubuntu vm on an m1 macbook pro than on an intel thinkpad x1, so maybe
i should just shut up and run a full-screen vm all day!)

> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net


More information about the Toybox mailing list