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
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# bench.sh — race fastwc against GNU coreutils wc on line counts, file input.
|
||||
# Includes the monster cases: 100M lines raced against coreutils, and 1B
|
||||
# lines timed solo (no reference to beat — there isn't one).
|
||||
# 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: lines, file input (%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' '--- lines ---'
|
||||
if ! run_cases lines -l 10000 100000 1000000 10000000; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' '--- monster: 100M lines vs coreutils ---'
|
||||
if ! run_cases lines -l 100000000; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '%s\n' '--- monster: 1B lines, solo ---'
|
||||
run_solo_case 1000000000 -l
|
||||
|
||||
printf '\nall %s lines benchmarks passed — fastwc was never slower than %s wc\n' \
|
||||
"$BENCH_NAME" "$BENCH_NAME"
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
# bench.sh — race fastwc against GNU coreutils wc on word counts, file input.
|
||||
# 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: words, file input (%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' '--- words ---'
|
||||
if ! run_cases words -w 1 10 100 1000 10000 100000; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '\nall %s words benchmarks passed — fastwc was never slower than %s wc\n' \
|
||||
"$BENCH_NAME" "$BENCH_NAME"
|
||||
Reference in New Issue
Block a user