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:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# bench.sh — race fastwc against GNU coreutils wc on standard input, fed by
|
||||
# shell redirect (the same path every real pipeline uses). Counts must agree
|
||||
# with coreutils' stdin behavior, and fastwc must not be slower.
|
||||
# Fails fast: the moment fastwc is slower than (or disagrees with) coreutils
|
||||
# wc, a human readable report is written to FAILED-benchmark.txt and this
|
||||
# script exits non-zero.
|
||||
#
|
||||
# usage: ./bench.sh
|
||||
set -u
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_DIR="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||
source "$REPO_DIR/benchmarks/std.sh"
|
||||
|
||||
checkfastwc
|
||||
checkwc coreutils
|
||||
BENCH_NAME="coreutils"
|
||||
|
||||
printf 'benchmarking %s wc vs fastwc: stdin (%s interleaved runs each, minimum kept)\n' \
|
||||
"$BENCH_NAME" "$BENCH_REPS"
|
||||
printf '%-28s %10s %10s %8s %s\n' 'test' 'wc' 'fastwc' 'ratio' 'status'
|
||||
|
||||
printf '%s\n' '--- stdin lines ---'
|
||||
if ! run_stdin_cases lines -l 10000 100000 1000000 10000000; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' '--- stdin words ---'
|
||||
if ! run_stdin_cases words -w 1000 100000 1000000; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' '--- stdin lines+words+bytes ---'
|
||||
if ! run_stdin_cases lines -lwc 1000000; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '\nall %s stdin benchmarks passed — fastwc was never slower than %s wc\n' \
|
||||
"$BENCH_NAME" "$BENCH_NAME"
|
||||
Reference in New Issue
Block a user