summaryrefslogtreecommitdiffhomepage
path: root/web
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-29 15:18:20 -0600
committerGitHub <noreply@github.com>2026-11-29 15:18:20 -0600
commitd87496e7f577ab4909054a27310cf4d34e2fcfa5 (patch)
tree3fe71056e1ae538fa5657c7363e75cf9f1e99239 /web
parent9407e4f94496266bf382a4fc8a46a4131740af45 (diff)
parente1baf8c2cbd41128a68d75cacb9f68155c4317d9 (diff)
downloadzash-main.tar.gz
Merge pull request #52 from skurtz97/web/hero-comparisonHEADmain
web: update hero comparison and expand z/OS & Linux benchmarks
Diffstat (limited to 'web')
-rw-r--r--web/content/_index.md75
-rw-r--r--web/layouts/home.html21
2 files changed, 79 insertions, 17 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
diff --git a/web/layouts/home.html b/web/layouts/home.html
index a77c48b..957fe8a 100644
--- a/web/layouts/home.html
+++ b/web/layouts/home.html
@@ -20,20 +20,25 @@
<span class="dot"></span><span class="dot"></span><span class="dot"></span>
<span class="title">zos: ~/src/zash &mdash; 10 000 command substitutions</span>
</div>
- <pre><code><span class="cmd">time dash -c 'i=0; while [ $i -lt 10000 ]; do x=$(echo hi); i=$((i+1)); done'</span>
-<span class="out">real</span> 0m4.54s
-<span class="out">user</span> 0m2.16s
-<span class="out">sys</span> 0m2.86s
+ <pre><code><span class="cmd">time bash -c 'i=0; while [ $i -lt 10000 ]; do x=$(echo hi); i=$((i+1)); done'</span>
+<span class="out">real</span> 0m37.12s
+<span class="out">user</span> 0m20.32s
+<span class="out">sys</span> 0m6.77s
+
+<span class="cmd">time /bin/sh -c 'i=0; while [ $i -lt 10000 ]; do x=$(echo hi); i=$((i+1)); done'</span>
+<span class="out">real</span> 0m12.54s
+<span class="out">user</span> 0m3.67s
+<span class="out">sys</span> 0m1.22s
<span class="cmd">time ./zash -c 'i=0; while [ $i -lt 10000 ]; do x=$(echo hi); i=$((i+1)); done'</span>
<span class="out">real</span> <span class="ok">0m0.01s</span>
<span class="out">user</span> <span class="ok">0m0.01s</span>
-<span class="out">sys</span> 0m0.00s<span class="cursor"></span></code></pre>
+<span class="out">sys</span> <span class="ok">0m0.01s</span><span class="cursor"></span></code></pre>
</div>
<p class="caption">
- Every <code>$( )</code> starts a process in dash and none in zash. One run
- on Linux x86-64; <code>make bench</code> repeats each case and checks the
- answers.
+ Every <code>$( )</code> starts a process in bash and <code>/bin/sh</code>,
+ and none in zash. One run on z/OS; <code>make bench</code> repeats each
+ case and checks the answers.
</p>
<div class="spec-strip">
<span>C23</span>