[Toybox] [landley/toybox] Release notes for 0.8.10 (cbc3e2c)
Rob Landley
rob at landley.net
Tue Aug 1 09:59:40 PDT 2023
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:
__ __ _ _ __ __ _
| \/ | __ _ ___ _ __ ___ (_)_ __ (_) | \/ / |
| |\/| |/ _` |/ __| | '_ ` _ \| | '_ \| | | |\/| | |
| | | | (_| | (__ | | | | | | | | | | | | | | | |
|_| |_|\__,_|\___| |_| |_| |_|_|_| |_|_| |_| |_|_|
___ ____
_ _ __ ___ __ _ ___ / _ \/ ___| 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...)
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...
Rob
More information about the Toybox
mailing list