summaryrefslogtreecommitdiffhomepage
path: root/bench
Commit message (Collapse)AuthorAgeFilesLines
* interactive: one editor, no libraryeditor/one-editorSean Kurtz4 days2-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | libedit was a compile-time alternative (`make EDIT=libedit`). It goes: FreeBSD and NetBSD `sh` use it because it is in their base system, which is not the case on z/OS, and it cost about a third of a millisecond to reach the prompt -- three more shared libraries, `el_init()`, an `~/.editrc` read and a copy of the history -- for the same cost per key. What it bought was `~/.editrc` bindings and a kill ring; `bind` and the built-in editor's own bindings cover the keys, and a second editor meant a second build mode and a second set of interactive expectations, with seven tests skipping under it. Everything that existed only to serve two editors goes with it: the `EDIT` switch and the two `edit_$(EDIT)` paths in the makefile, the `$ZASH_EDITOR` variable the tests used to skip, the skip guards in `tests/linux/`, the NUL stripping in `ptydrive.py` that libedit's redraw needed, and the parallel paragraphs in README.md, DESIGN.md, bench/README.md and the two website pages. `bench/README.md` keeps the measurement, since that is why the decision is written in DESIGN.md. Checked on Linux (97 passed, 1 skipped, the one known local failure in linux/i-dscomplete) and on z/OS (64 passed, 3 skipped, 0 failed, plus the EBCDIC build).
* bench: make the start-up number a minimum of interleaved roundsbench/startup-roundsSean Kurtz4 days2-9/+39
| | | | | | | | | | | | | | | | | | | | | | startup.sh ran BENCH_N starts once, and on the shared z/OS machine the same binary measured anywhere between 5 and 14 ms depending on the hour. Now each cell is the fastest of BENCH_R rounds (default 5) of BENCH_N starts, and a row's two columns are measured one after the other inside each round, so `-c :` and `script` see the same load instead of one following five rounds of the other. A minimum is the right summary because contention only adds time. Measured that way on cbt today, zash is 1.34 ms for `-c :` and 1.36 ms for a script, and the z/OS sh 2.16 and 2.18 — the same two numbers bench/README.md already claimed from a quieter machine, which is the point: the method now reproduces them. Also records the rule the ksh88 constraint implies: where zash and the z/OS sh disagree, zash keeps the better behaviour unless a ksh88 script could observe it, and the one such case — a failed redirection, assignment or read being 2 rather than 1 — is accepted because POSIX does not pin it and the shells disagree among themselves.
* bench: read the 28 differences from the host's shbench/compat-triageSean Kurtz4 days1-3/+31
| | | | | | | | | | | | | | Every script that zash and the IBM sh disagree on has now been read. None is a zash bug: zash matches dash on all 38 (that is what the suite says), and the differences are the IBM shell's — it cannot do `[ a \< b ]`, `fc`, or arithmetic across a newline; it exits where `command eval` should only set a status; it keeps literal quotes inside `${y:-"q r"}` and empty fields from unquoted `$@`; its exit status is 1 for every failure. The one row that is our choice is the status one: the ash family's 2 for a failed redirection, which DESIGN.md already lists and this now records in the table, so that a ksh script on z/OS testing `$?` against 1 is not a surprise.
* bench: measure zash against the sh this host hasbench/host-sh-compatSean Kurtz4 days2-0/+73
| | | | | | | | | | | | `compat.sh` runs every tests/posix script under zash and under another shell, each in an empty directory, and prints the ones whose output or status differ. It is not a test: the .exp files are a reference shell's output, and on z/OS /bin/sh is IBM's ksh-lineage shell with wording and statuses of its own. The count is how close a script naming #!/bin/sh gets to its meaning here; the diffs say which differences to read. On cbt, 10 of the 38 scripts agree and 28 differ, most of them on diagnostics.
* interactive: a prompt's width counts columns, not bytesSean Kurtz4 days3-3/+141
| | | | | | | | | | | | | | | | | | | | | The built-in editor skipped `ESC [ ...` sequences when working out where the prompt ends. Colour and titles are not all CSI: an OSC title or hyperlink runs to BEL or `ESC \`, DCS runs the same way, and `tput sgr0` is the three-byte `ESC ( B` before `ESC [ m`. A prompt built with `$(tput ...)` was measured wrong, which costs the cursor position and with it the wrapped-line arithmetic. `esc_seq_len()` in interact.c now walks what a terminal understands, and edit_builtin.c uses it. The libedit build shares the walk: it brackets control runs for `EL_PROMPT_ESC`, and adds the space libedit needs when a prompt ends in one, since libedit attaches a literal run to the character after it. bench/editor.py measures the two costs run.sh cannot see, start to first prompt and per-key echo, on a pty; bench/README.md has the table. The release, z/OS and fuzz builds move to -O3 while the sanitizer and coverage builds stay low: inlined frames make their reports harder to read than the few percent they would gain.
* docs: the z/OS tables and prose at 64-bit, C23 and the LPASean Kurtz4 days1-52/+69
| | | | | | | | | README's benchmark table is the 64-bit run with the run-time in the LPA and zsh installed (it was the 2.1-era table, and its zsh column was the 31 ms start-up, not zsh). bench/README.md keeps the 2.1 numbers as the history of what the LPA fixed, and gains the start-up table it now has a measurement for. investigation.md's §2 recommendation was still "build 31-bit"; it now says what happened instead.
* C23: nullptr for null pointers, constexpr for typed constantsSean Kurtz5 days1-1/+1
| | | | | | | | | | | | | | nullptr in every place a null pointer constant was meant; NULL is gone from src/. constexpr where it improves on #define without costing anything: the IGGCSI00 work-area offsets and sizes, and the scalar sizes MVS_DSN_MAX, CSI_FIELD_LEN, CSI_WORK_MIN, PDS_DIRBLK, CSI_WORK, CSI_MAX_CALLS. A constexpr in C is a constant expression, so it still bounds the arrays that use it, and it now carries a type and can be checked with static_assert. Feature switches (#if), the CSIETYPE/EBCDIC byte constants read as octets, and the related-constant enum sets stay as they were.
* build: make the 64-bit z/OS build the defaultSean Kurtz5 days1-20/+33
| | | | | | | | | | | | | | | | | | | | | | zash is built 64-bit on z/OS now: -m64 for the ASCII and the EBCDIC build and for the debug build, and `make` as well as `make zash` land on zos-ascii there. The 31-bit build existed for the 64-bit start and fork costs, which were the C run-time being loaded out of the linklist; with CELQ* in the LPA the widths measure the same and the shell is built at the width IBM builds for. The catalog and dynamic-allocation modules are AMODE 31 and OS_UPSTACK does not exist at -m64, so both are declared with plain OS linkage, which is the 64-bit glue for an AMODE 31 callee. Neither module is installed on the test system, so that path is unverified there; csi_call() still catches a program check and retires the catalog. IGGCSI00's VL bit comes from the width of a pointer, not 0x80000000. Documentation follows: README gains a Recommendations section for the LPA change and loses the 31-bit rationale; DESIGN.md's cost model, catalog linkage and open questions match the measurements; bench/README states the current width and the rerun numbers; investigation.md records the decision.
* docs: name the system by release, not by its hostnameSean Kurtz5 days1-2/+2
|
* bench: the 64-bit start-up cost was the runtime not being in the LPA (#20)Sean Kurtz5 days1-0/+32
| | | | | | | Adding the CELQ members of CEE.SCEERUN2 to the dynamic LPA takes a trivial 64-bit start from 5.83 ms to 1.63 ms, the fork() cost from 4.20 ms to 0.10 ms, and /bin/zsh from 31.4 ms to 3.6 ms. The 27x ratio this repo has been explaining since PR #15 was a system not following IBM's own advice for the 64-bit runtime.
* notes: the 64-bit runtime is loaded from the linklist, not the LPA (#19)Sean Kurtz5 days2-4/+6
| | | | | | | * bench: keep the HLASM probe comments out of the continue column Also fixes the tiny64.s header, which named tiny31.s. * notes: the 64-bit runtime is loaded from the linklist, not the LPA
* bench: keep the start-up and fork probes in bench/probesSean Kurtz5 days6-57/+124
| | | | | | | | | The probe sources only existed inline in the docs and in a scratch directory on the z/OS box, so the numbers in bench/README.md could not be reproduced from the repository. fk3.c (fork cost against parent storage), tiny.c (start-up cost) and the HLASM pair tiny31.s/tiny64.s (start-up with no C runtime) now live in bench/probes/, with run.sh building and timing them at both widths; the docs point at them instead of repeating them.
* Measure why 64-bit start-up is slow, and record the answer (#16)Sean Kurtz5 days3-2/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bench: time one start with a parent that is not an LE program `bench/startup.sh` times a shell loop, so on z/OS every child pays the 31-bit shell's own price and the 64-bit start-up cost cannot be separated from it. `tests/tools/spawn` forks one child at a time and reports wall and child CPU per start, and `bench/le-init.sh` builds the 31-bit, 64-bit and HLASM programs it times in a work directory, so the table needs nothing checked in but the script. The child's environment is built by hand and passed to `execve`: `putenv` after LE has initialized is not handed to the child, and `_CEE_RUNOPTS` exported to an LE parent makes that parent's `execl` fail, which a fork loop that does not check exit status reports as a fast start. * notes: the 64-bit start-up cost is LE waiting, not the address mode Measured on the CBT z/OS 29.00 system: a 64-bit HLASM program with no LE starts in 1.39 ms, the same source at -m32 in 1.5-1.8 ms, so the address space, the loader and XPLINK are free. A -m64 start spends 4.5-28 ms before the first instruction of main, of which only 1.0-1.25 ms is charged to the child: the rest is wall time on something shared, which does not overlap between concurrent starts while it is at 28 ms and does once it drops to 5.8 ms. No _CEE_RUNOPTS option moves it. That retracts an earlier POSIX(OFF) result in these notes: exporting the option to an LE parent makes its execl fail, so the run timed failed execs. Applied to the child, POSIX(OFF) changes nothing.
* bench: take a shell path that is relative to where run.sh was calledbench/startupSean Kurtz5 days1-0/+1
| | | | | The harness chdirs to a work directory, so `./zash`, the form the usage line shows, resolved to nothing.
* bench: start-up table in the README, measured on z/OS and LinuxSean Kurtz5 days1-12/+54
| | | | | | bench/startup.sh had to exist before the README could stop saying the number was missing. On z/OS zash starts in 1.33 ms against 2.20 ms for /bin/sh and 31.4 ms for zsh.
* bench: measure start-up wall time against the other shellsSean Kurtz5 days2-1/+84
| | | | | | | | | | | run.sh times CPU, so the milliseconds a process spends before it runs anything never appear in it: zash can read 0.00 in a subshell row while zash -c : costs a few ms of wall time. bench/startup.sh measures that directly, one start per command, and bench/README.md now has a table instead of a warning that the number is missing. The clock is tests/tools/now.c, ten lines, because /bin/date on z/OS has no sub-second format.
* docs: humanize the markdown docsdocs/startup-probeSean Kurtz5 days1-67/+72
| | | | | | | | | Plain sentences where the prose had decorative bold lead-ins, em dashes and one-line closers. Claims, numbers and commands are unchanged, except two corrections that the startup probe settled: README said the remaining z/OS gap was the price of the address mode, and DESIGN's open question on `a | b &` said the gain depended on the address mode. Both are the 64-bit C run-time, not the address mode.
* docs: keep the probe write-up in notes/investigation.mdSean Kurtz5 days1-25/+7
| | | | | | The assembler-vs-C experiment, its method and the questions it leaves open get a tracked home outside the generated docs/ tree; bench/README keeps the result table and points there.
* docs: the 64-bit start-up cost is LE, not the address modeSean Kurtz5 days1-9/+62
| | | | | | | | | An AMODE 64 HLASM program that returns 0 without any C run-time starts in 0.8 ms, the same as the AMODE 31 copy, while the same empty program in C costs 29.4 ms at -m64 and 2.0 ms at -m32. So the 28 ms is Language Environment's 64-bit initialization, not the address space, and the 31-bit LE start is about 1 ms. Records the probe and corrects the claims in bench/README.md and DESIGN.md.
* bench: name the baseline shell /bin/sh, not ksh88, in prosedocs/readme-currentSean Kurtz6 days1-3/+3
|
* bench: keep a label with a space in one columnSean Kurtz6 days1-5/+6
|
* bench: label the z/OS baseline column "z/OS sh"Sean Kurtz6 days2-4/+4
|
* z/OS: run 31-bit and load IGGCSI00 through the C librarySean Kurtz6 days1-0/+297
| | | | | | | | | | | | | zash was AMODE 64, so calling the AMODE 31 IGGCSI00 needed assembler glue (zos_csi.s) that switched addressing mode around the branch. Built with -m32 the program is 31-bit itself: the call goes through a plain function pointer, the work area and the saved registers live in one 31-bit block in C, and the glue is gone. The rest of the tree follows the change: the build, the off-z/OS lint shim, DESIGN.md and README.md, the benches, the Lean spec of the pattern matcher, and the tests that recorded what the extra address bits had changed.
* added new benches, the logo, and a formal spec for possible verification.Sean Kurtz9 days7-0/+81
|
* bench: 200 background jobs, which is what z/OS lets a shell forkSean Kurtz10 days1-1/+1
|
* bench: more of what a script actually doesSean Kurtz10 days11-0/+128
| | | | | | | | | | | | | Eleven more benchmarks, each one a subsystem rather than a syntax form: here-documents, getopts, redirections, subshells, background jobs, printf, parameter expansion, IFS field splitting, case dispatch, recursion, and bash-style ${v/a/b} substitution. They print one line that every shell must agree on, so they are tests too, and the harness reports n/a where the shell lacks the feature. .pi-lens.json turns off its reserved-identifier rule: every match in this tree is a C11 keyword (_Static_assert, _Noreturn, _Alignas) or a runtime name (_exit, __malloc31, _CVSCSID) that has to be spelled that way.
* bench: a probe must fail when the feature is missingSean Kurtz11 days1-1/+3
| | | | | | An if with no else clause answers 0 even when its condition failed, so dbracket's probe reported success on dash and the row said differs instead of n/a. The probe now says so itself.
* bench: keep the arithmetic totals inside 32 bitsSean Kurtz11 days14-2/+17
| | | | | | | ksh88 works in 32-bit integers, so summing i*2 over 200000 iterations overflowed and the benchmark reported "differs" instead of a time: the same script, two answers. Summing (i % 100) * 2 does the same work and fits in 31 bits.
* bench: name the columns, and run the ksh features against ksh88Sean Kurtz11 days4-16/+65
| | | | | | | | | | | | The column for z/OS /bin/sh said sh, which hid that it is IBM's ksh88 port, and two benchmarks skipped it for the wrong reason: dbracket probed [[ ]] with eval, which ksh88 rejects even though [[ ]] works, and arithcmd used (( )) as a command, which is ksh93 and not ksh88. run.sh now takes shell=label arguments and labels /bin/sh as ksh88 on z/OS, and BENCH selects a subset. dbracket probes the form it uses. arithcmd keeps to typeset -i, let and $(( )), so ksh88 runs it, and the (( )) command form moved to dparen.sh.
* Readme icon and contents, a security test, realistic bench scriptsSean Kurtz11 days2-0/+49
| | | | | | | | | | | | | | | | | README.md shows the shell's icon on a light or dark background, has a table of contents, and says C17 rather than C11 (the tree has built C17 since b4d6bf1). tests/zos/security.sh is the security-relevant half of the suite: a file created by redirection or mkdir takes the umask, a redirect into a directory without write permission fails, the current directory is not searched for a command, ENV is not read by a non-interactive shell, and neither an expansion nor a file name is re-parsed. bench/report.sh counts a generated log by level and hour, and bench/deploy.sh renders and verifies 100 configs from a template. Both are realistic scripts and both are compared for output against other shells by bench/run.sh, so they fail as tests as well as being timed.
* bench: read every shell's times output, and feed scripts on stdinSean Kurtz11 days1-6/+20
| | | | | | | | z/OS `times` differs per shell (ksh88 `0m 1.16s`, bash `0m1.160s`, oksh `0m01.16s`), and the old parser assumed bash's shape, multiplying ksh88's seconds by 60. z/OS zsh cannot open an ASCII-tagged script by name, so benchmarks go in on stdin. The probe list also looks for zsh and oksh now.
* Docs: tagging, CSI completion, z/OS options, off-z/OS checking; tagging benchSean Kurtz2026-11-151-0/+65
| | | | | | DESIGN.md gains the reference for file tags and conversion, MVS name completion and the CSI glue's storage layout, the per-command z/OS options, and how z/OS code is checked on Linux. bench/tagging.sh measures tagging cost on z/OS (n/a elsewhere).
* Add [[ ]], make coverage, and fixes found by edge-case testsSean Kurtz2026-11-152-0/+18
| | | | | | | [[ ]] is parsed into a tree and evaluated without argv or lookup. Fixes: errexit inside a tested subshell, the ${x:?} message, arithmetic on variables holding expressions, printf %c of an empty argument, job text for arithmetic, and \n and \e prompt escapes.
* Tests and benchmarks for the extensions and the interactive layerSean Kurtz2026-11-132-2/+17
| | | | | | | | New zash/ tests for each extension, a proc/ test showing they create no processes, and linux/i-*.sh tests that drive the interactive shell on a pseudo-terminal (tests/tools/ptydrive.py; skipped without python3). The runner counts exit status 77 as "skipped". Adds a benchmark for the arithmetic commands and removes a stray file from tests/posix.
* zash: scripting core, test suite and benchmarksSean Kurtz2026-11-128-0/+102
A clean-slate POSIX shell for z/OS UNIX in the Almquist tradition, written in C23 for Clang (Linux) and IBM Open XL C/C++ (z/OS). - Parser, expansion, arithmetic, redirection, traps and builtins. - Spawn-first execution: fd plans instead of fork+dup2, in-shell pure builtins for pipelines and command substitution, $(a | b) without a subshell. - Flat .POSIX Makefile; asan, valgrind, bench, compdb and z/OS targets. - Tests: posix (dash-generated), zash, process accounting, linux, zos. Nothing has been compiled or run on z/OS yet.