diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-19 17:41:40 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-19 17:41:40 -0600 |
| commit | ee11872c1f67b6d2ca407adbb8975723eb53a3bc (patch) | |
| tree | 6c6c32663909d7d1ca49584aa0bf28a83a54335b | |
| parent | c8ed6c77ff379678c7b24866d711eeb7fda59dbd (diff) | |
| download | zash-ee11872c1f67b6d2ca407adbb8975723eb53a3bc.tar.gz | |
README: the subshell row, after running it in the shell
| -rw-r--r-- | README.md | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -195,7 +195,7 @@ processes by more: | `case` dispatch | 0.03 | 0.07 | 0.20 | 0.09 | 0.14 | | small pipelines and `$(a \| b)` | 1.10 | 2.35 | 3.16 | 1.33 | 2.32 | | 2000 external commands | 0.55 | 0.53 | 0.81 | 0.56 | 0.84 | -| subshells | 0.35 | 0.36 | 0.64 | 0.01 | 0.50 | +| subshells | 0.01 | 0.34 | 0.62 | 0.00 | 0.46 | | background jobs | 0.03 | 0.03 | 0.06 | 0.04 | 0.03 | | redirections | 0.07 | 0.08 | 0.11 | 0.09 | 5.85 | | here-documents | 0.03 | 0.03 | 0.08 | 0.10 | 0.13 | @@ -237,9 +237,9 @@ as `n/a` there: | `[ ]` tests in a loop | 0.15 | 1.39 | 1.97 | 1.07 | 0.96 | | `case` dispatch | 0.08 | 0.64 | 0.80 | 0.33 | 0.59 | | small pipelines and `$(a \| b)` | 0.77 | 1.69 | 34.78 | 28.00 | port bug | -| 2000 external commands | 0.60 | 0.56 | 14.22 | 11.64 | 10.12 | -| subshells | 14.16 | 0.82 | 20.90 | 16.87 | 14.57 | -| background jobs | 0.88 | 0.13 | 1.36 | 1.09 | 0.92 | +| 2000 external commands | 0.57 | 0.52 | 14.22 | 11.64 | 10.12 | +| subshells | 0.01 | 0.80 | 20.90 | 16.87 | 14.57 | +| background jobs | 0.93 | 0.14 | 1.36 | 1.09 | 0.92 | | redirections | 0.28 | 0.36 | 0.46 | 0.33 | 61.63 | | here-documents | 0.29 | 1.20 | 0.49 | 1.15 | 0.85 | | `while read` over a file | 0.30 | 0.91 | 0.84 | 3.31 | port bug | @@ -259,16 +259,15 @@ stage costs a full z/OS spawn there, from 14 s (bash, 2000 commands) to 283 s (bash, 40000 substitutions). zash does those substitutions and `print`/`echo` pipeline stages in-shell, so its rows stay near ksh88's, which is what z/OS shops already pay. Plain external commands cost zash what -they cost ksh88 (0.60 against 0.56), so nothing was traded away for the +they cost ksh88 (0.57 against 0.52), so nothing was traded away for the rest. -A `fork()` is the expensive call on z/OS rather than a `spawn()`: 3000 -subshells cost zash 14.2 s, 4.7 ms each, against 0.3 ms for each of the -2000 external commands, because a fork copies the address space where a -spawn can share it. ksh88 answers `( : )` without forking at all, which -is why its subshell row is 0.82. zash forks a subshell even when its -body is a builtin that cannot change anything outside it, and that is -the one row here with work left in it. +A `fork()` costs more on z/OS than a `spawn()`, because the fork copies +the address space where the spawn can share it. That used to be visible +in the subshell row: 3000 `( : )` shells, each forking, took 14.2 s. A +subshell whose body is one output-only builtin now runs in the shell, +like a pipeline stage already did, so the same 3000 cost 0.01 s here +against ksh88's 0.80. The `port bug` entries are the third-party `oksh` port's, not zash's: on there `echo hi | cat` prints two bytes of garbage, so those rows |
