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
+9 -9
View File
@@ -9,8 +9,9 @@ These aren't guidelines. They're the deal.
### 1. The benchmark is the contract
`./benchmarks/bench-coreutils.sh` must pass. Not "mostly pass." Not
"pass on your machine." Pass.
`./benchmarks/test-all.sh` must pass. Not "mostly pass." Not "pass on
your machine." Pass. Every suite — words, lines (monsters included),
and stdin — races fastwc against GNU wc.
The moment fastwc is slower than GNU wc — or disagrees with it on a
single count — your change does not ship. We did not spend this much
@@ -40,9 +41,9 @@ feature smaller.
### 4. The hot path is sacred
`count_stream()`, `count_newlines()`, and `count_words()` in
`src/main.c` are the entire point of this project. You may touch them
only if `./benchmarks/bench-coreutils.sh` still passes afterward.
`count_stream()`, `count_newlines()`, `count_words()`, and the SIMD
kernels in `src/main.c` are the entire point of this project. You may
touch them only if `./benchmarks/test-all.sh` still passes afterward.
Rules for the counting loops:
- fixed stride, no per-token function calls
@@ -85,14 +86,13 @@ GNU's excuses.
Good first issues:
- Closing the 1M-line AVX-512 gap (the only loss on the board)
- Benchmark case coverage for `-m` and multiple files
- `bench-busybox.sh` CI on a machine that actually has busybox
- Move the 1B-line monster behind a flag so quick CI runs stay quick
Ambitious issues:
- A word counter that doesn't just tie GNU — it embarrasses it
- Bigger SWAR chunks, wider strides, less patience
- A word counter that doesn't just beat GNU — it embarrasses it
- Wider strides, less patience, and a 10B-line monster
### Send a PR