summaryrefslogtreecommitdiffhomepage
path: root/bench/README.md
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-25 21:54:21 -0600
committerGitHub <noreply@github.com>2026-11-25 21:54:21 -0600
commit8783efd12edd6ab739b8eee7776d6c744df4f677 (patch)
treebadd8a2f1485c15280cdf7c64a167b9ffd0e47c5 /bench/README.md
parentc980daddaa17460a65fe1ce7511b680279381dc1 (diff)
parent87c6a0f8f822c57b4f63bc8bb099a33307871414 (diff)
downloadzash-editor/vi-v-dot.tar.gz
Merge pull request #39 from skurtz97/editor/one-editoreditor/vi-v-dot
interactive: one editor, no library
Diffstat (limited to 'bench/README.md')
-rw-r--r--bench/README.md31
1 files changed, 16 insertions, 15 deletions
diff --git a/bench/README.md b/bench/README.md
index 9621ba3..128748c 100644
--- a/bench/README.md
+++ b/bench/README.md
@@ -363,37 +363,38 @@ has no sub-second format. `BENCH_N` sets the number of starts, and
## The line editor
-`EDIT=libedit` replaces the built-in editor with libedit, and the two
-costs it changes are both in the interactive path, which `run.sh` and
-`startup.sh` do not touch. `editor.py` measures them on a
+The editor is built in, and `editor.py` is what made that decision easy.
+It measures the two costs the off-the-shelf editor changed, both in the
+interactive path that `run.sh` and `startup.sh` do not touch, on a
pseudo-terminal: `BENCH_N` starts, each timed from just before the fork
to the first byte of the prompt, then `BENCH_KEYS` keys typed one at a
time, each timed from the write to its echo.
```sh
-make EDIT=libedit LDLIBS=-ledit # writes ./zash, keep a copy
-cp zash zash-libedit && make zash # the built-in one
-python3 bench/editor.py ./zash ./zash-libedit
+python3 bench/editor.py ./zash dash bash # any shells, it types at each
```
-Linux, both `-O3`, 20 and then 50 starts, keys medians of 200:
+Linux, `-O3`, 20 and then 50 starts, keys medians of 200:
| editor | start | one key |
| --- | --- | --- |
| built-in | 0.94-1.02 ms | 7.2-8.5 us |
| libedit | 1.20-1.27 ms | 7.2-7.4 us |
-libedit pays about a third of a millisecond more to get to the prompt:
-three more shared libraries to load (libedit, ncurses, and the terminfo
-entry it reads), `el_init()`, an `~/.editrc` attempt, and the copy of
-the shell's history into libedit. Every key costs the same either way;
-the round trip is the terminal driver and the scheduler, and the editor's
-own work on a key is too small to see through that.
+libedit, which zash could be built against (`make EDIT=libedit`) until it
+was dropped, paid about a third of a millisecond more to get to the
+prompt: three more shared libraries to load (libedit, ncurses, and the
+terminfo entry it reads), `el_init()`, an `~/.editrc` attempt, and the
+copy of the shell's history into libedit. Every key costs the same either
+way; the round trip is the terminal driver and the scheduler, and the
+editor's own work on a key is too small to see through that.
-So the built-in editor wins a start that never edits, which is the case
+So the built-in editor wins the start that never edits, which is the case
`make check` and a `#!` line are; for a session spent typing, the two are
the same. Neither forks or execs per key, which is the cost that would
-have mattered.
+have mattered. DESIGN.md records the rest of the reason: FreeBSD and
+NetBSD `sh` use libedit because it is in their base system, and z/OS has
+no such thing.
## Address mode: 64-bit now