Race the UTF-8 decoder against coreutils
Every case in the suite pinned LC_ALL=C, so the multibyte path - the one whose counts go wrong quietly rather than crashing - had no contract behind it at all. genfile grew a --utf8 mode that writes mixed CJK, ASCII words, a tab, an ideographic space, a no-break space and a combining accent, and the words suite now races -w, -m and -L over 300k lines of it under en_US.UTF-8 (C.UTF-8 as a fallback), against coreutils. The case runs the locale on both sides rather than inheriting the C pin, because the oracle's own decoder is the reference. It prints SKIP rather than passing when the host has no UTF-8 locale: a multibyte count cannot be checked in a single-byte one.
This commit is contained in:
@@ -30,3 +30,19 @@ for oracle in $ORACLES; do
|
||||
printf '\nall %s words benchmarks passed — fastwc was never slower than %s wc\n' \
|
||||
"$BENCH_NAME" "$BENCH_NAME"
|
||||
done
|
||||
|
||||
# The multibyte path, raced against coreutils only: under a UTF-8 locale
|
||||
# wc decodes, and the case is about our decoder agreeing with its counts
|
||||
# and beating its speed. 300k mixed lines is about 6 MB, which is enough
|
||||
# for both sides to be counting rather than starting.
|
||||
select_oracle coreutils || exit 1
|
||||
printf '\n%s\n' '--- multibyte, UTF-8 locale (coreutils) ---'
|
||||
if ! run_utf8_case words 300000 -w; then
|
||||
exit 1
|
||||
fi
|
||||
if ! run_utf8_case chars 300000 -m; then
|
||||
exit 1
|
||||
fi
|
||||
if ! run_utf8_case 'longest line' 300000 -L; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user