bench: rub it in — monsters, stdin wins, busybox retired

Suites split into benchmarks/files/{lines,words} and
benchmarks/stdin/piping, with the monsters bolted onto the lines suite:
100M lines raced against coreutils (~2x win), 1B lines solo (~6-8s,
11 GB in one pass). Stdin redirects from regular files are now mmap'd
in count_stream, so the stdin suite wins too — up to 12.00x on words.

The ratio column now reports how many times faster fastwc is, not how
much of GNU's time it used. busybox was removed from the suite: it
stopped being a challenge and started being a participation trophy.
GNU wc's lone win — 1M lines by one millisecond on hand-tuned AVX-512
assembly — is now a historical footnote, and the README says so.
This commit is contained in:
2026-08-29 15:52:24 -04:00
parent ff465e981b
commit 6aa461f053
13 changed files with 362 additions and 177 deletions
+12 -8
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
# test-all.sh — compile the benchmark helper tools first, then run every
# benchmark (coreutils and busybox). Exits non-zero if any of them fails.
# benchmark suite (words, lines incl. monsters, stdin). Exits non-zero if
# any of them fails.
#
# usage: ./test-all.sh
set -u
@@ -16,15 +17,18 @@ if ! cc -O2 -Wall -o "$SCRIPT_DIR/tools/genfile" "$SCRIPT_DIR/tools/genfile.c";
fi
printf 'built %s\n' "$SCRIPT_DIR/tools/genfile"
# 2. run each benchmark (both run regardless, so every result is reported)
"$SCRIPT_DIR/bench-coreutils.sh"
rc_coreutils=$?
"$SCRIPT_DIR/bench-busybox.sh"
rc_busybox=$?
# 2. run each suite (all run regardless, so every result is reported)
"$SCRIPT_DIR/files/words/bench.sh"
rc_words=$?
"$SCRIPT_DIR/files/lines/bench.sh"
rc_lines=$?
"$SCRIPT_DIR/stdin/piping/bench.sh"
rc_stdin=$?
# 3. summarize
if [[ $rc_coreutils -ne 0 || $rc_busybox -ne 0 ]]; then
printf '\ntest-all: FAILED (coreutils=%s, busybox=%s)\n' "$rc_coreutils" "$rc_busybox" >&2
if [[ $rc_words -ne 0 || $rc_lines -ne 0 || $rc_stdin -ne 0 ]]; then
printf '\ntest-all: FAILED (words=%s, lines=%s, stdin=%s)\n' \
"$rc_words" "$rc_lines" "$rc_stdin" >&2
exit 1
fi
printf '\ntest-all: all benchmarks passed\n'