diff options
Diffstat (limited to 'web/content/_index.md')
| -rw-r--r-- | web/content/_index.md | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/web/content/_index.md b/web/content/_index.md index 107a548..e24eebf 100644 --- a/web/content/_index.md +++ b/web/content/_index.md @@ -23,8 +23,7 @@ billed, and every `fork()` copies an address space. <h3>sh scripts, not a dialect</h3> <p>Scripts written for zash run under the existing <code>/bin/sh</code>, dash, FreeBSD sh and bash. zash is the successor to IBM's KornShell-line - <code>/bin/sh</code>, not a new language: the Korn features those scripts - use are there, where they cost other scripts nothing.</p> + <code>/bin/sh</code>, not a new language.</p> </li> <li> <span class="n">03</span> @@ -44,20 +43,78 @@ billed, and every `fork()` copies an address space. ## How it compares -CPU-seconds on Linux x86-64 from `make bench`, user+sys with children -included. The benchmark scripts check each shell's answers as well as timing -it. +CPU-seconds (user+sys, children included) from `make bench` / `bench/run.sh`. +The benchmark scripts check each shell's output against the reference shell as +well as timing it, so a wrong answer fails instead of merely being timed. + +### z/OS + +Measured on z/OS (64-bit ASCII build, with the 64-bit C run-time in the dynamic +LPA), against IBM's `/bin/sh` (`z/OS sh`), bash, zsh and oksh: + +| benchmark | zash | z/OS sh | bash | zsh | oksh | +| --- | --- | --- | --- | --- | --- | +| `$(builtin)` x 40000 | 0.04 | 20.63 | 22.44 | 51.34 | 36.49 | +| `(( ))` as a command | 0.14 | n/a | 0.94 | 0.39 | n/a | +| `[[ ]]` in a loop | 0.08 | 0.93 | 1.08 | 0.28 | n/a | +| `[ ]` tests in a loop | 0.12 | 1.40 | 1.62 | 1.10 | n/a | +| `case` dispatch | 0.06 | 0.64 | 0.78 | 0.35 | 0.59 | +| small pipelines and `$(a \| b)` | 0.62 | 1.60 | 4.21 | 6.74 | 3.37 | +| 2000 external commands | 0.49 | 0.52 | 1.55 | 2.87 | 1.39 | +| subshells | 0.00 | 0.78 | 1.32 | 3.66 | 0.80 | +| background jobs | 0.08 | 0.12 | 0.24 | 0.24 | 0.12 | +| redirections | 0.26 | 0.35 | 0.32 | 0.32 | port bug | +| here-documents | 0.31 | 1.09 | 0.72 | 1.03 | n/a | +| `while read` over a file | 0.30 | 0.93 | 0.93 | 3.27 | port bug | +| recursion | 0.04 | 0.24 | 0.28 | 0.22 | 0.20 | +| `printf` | 1.19 | 1.92 | 1.40 | 1.40 | n/a | +| `getopts` | 0.04 | 0.28 | 0.21 | 0.21 | n/a | +| parameter trimming | 0.12 | 0.98 | 0.58 | 0.58 | n/a | +| IFS field splitting | 0.04 | 0.32 | 0.05 | differs | n/a | +| pattern matching and `case` | 0.27 | 3.04 | 0.98 | 0.98 | n/a | +| count a log by level and hour | 0.17 | 0.54 | 1.20 | 1.20 | n/a | +| render and check 100 configs | 0.16 | 0.20 | 0.62 | 0.62 | n/a | +| file tagging and auto-conversion | 0.38 | 1.03 | 2.33 | 2.33 | n/a | + +The gap on z/OS is process creation: every command substitution, subshell and +pipeline stage costs a full spawn or address-space copy in the other shells, +whereas zash runs builtin command substitutions, output-only subshells and +`echo`/`print` pipeline stages in-shell. `n/a` means the shell lacks the +feature; `differs` means zsh did not field-split unquoted expansions; `port bug` +reflects output corruption in the third-party `oksh` port. + +### Linux x86-64 + +The same suite on Linux x86-64 via `make bench`, where `fork()` is cheap: | benchmark | zash | dash | bash | ksh93 | oksh | | --- | --- | --- | --- | --- | --- | | `$(builtin)` x 40000 | 0.01 | 8.20 | 17.99 | 0.11 | 25.24 | +| function calls | 0.03 | 0.07 | 0.25 | 0.13 | 0.12 | +| arithmetic loop | 0.07 | 0.19 | 0.53 | 0.24 | 0.31 | +| `let` and integer variables | 0.10 | n/a | 0.78 | 0.35 | 0.43 | +| `(( ))` as a command | 0.06 | n/a | 0.33 | 0.09 | 0.30 | +| `[[ ]]` in a loop | 0.04 | n/a | 0.29 | 0.12 | n/a | +| `[ ]` tests in a loop | 0.05 | 0.16 | 0.43 | 0.15 | 0.22 | +| `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 | -| render and check 100 configs | 0.38 | 0.46 | 0.53 | 0.26 | 0.52 | | 2000 external commands | 0.55 | 0.53 | 0.81 | 0.56 | 0.84 | +| subshells | 0.01 | 0.37 | 0.62 | 0.01 | 0.48 | +| 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 | +| `while read` over a file | 0.04 | 0.07 | 0.21 | 0.12 | 0.10 | +| recursion | 0.02 | 0.04 | 0.17 | 0.05 | 0.06 | +| `printf` | 0.09 | 0.12 | 0.23 | 0.16 | 19.70 | +| `getopts` | 0.02 | 0.03 | 0.09 | 0.03 | 0.05 | +| parameter trimming | 0.05 | 0.09 | 0.32 | 0.20 | 0.14 | +| IFS field splitting | 0.03 | 0.04 | 0.11 | 0.05 | 0.06 | +| pattern matching and `case` | 0.11 | 0.18 | 0.53 | 0.38 | 0.35 | +| count a log by level and hour | 0.04 | 0.05 | 0.13 | 0.07 | 0.08 | +| render and check 100 configs | 0.38 | 0.46 | 0.53 | 0.26 | 0.52 | -On z/OS the gap against IBM's `/bin/sh` is far wider, because a `fork()` there -copies an address space. The full tables for both platforms are in the -[project README](https://github.com/skurtz97/zash#status). +See the [project README](https://github.com/skurtz97/zash#status) for the +dynamic LPA notes and methodology. ## Get started |
