SIMD kernels (AVX-512/AVX-2/SSE2, runtime-dispatched) counting a single pass over mmap'd files, split across cores past 8 MiB, with exact GNU oracle parity (NBSP included, glibc's decoder fixed, the whole -m path mirrored so counts agree at every boundary). Result: 1ms vs 2ms at 1M lines, 8-9ms vs 22-24ms at 10M. Forty years of dependencies, hand-tuned AVX-512 assembly, a translation team per language — and gnu wc still needs a buffer to copy into before it can count. We mapped the file and just counted. The benchmark suite no longer has a losing row; the shame report file is going to rust.
37 lines
1012 B
Makefile
37 lines
1012 B
Makefile
AM_CFLAGS = -Wall -Wextra -O2 -pthread
|
|
|
|
bin_PROGRAMS = fastwc
|
|
fastwc_SOURCES = src/main.c
|
|
|
|
# Release build consumed by benchmarks/ (expects bin/release/fastwc).
|
|
release: all
|
|
$(MKDIR_P) bin/release
|
|
cp -f fastwc bin/release/fastwc
|
|
|
|
# Convenience: build the release binary, then run every benchmark suite.
|
|
bench: release
|
|
./benchmarks/test-all.sh
|
|
|
|
# --- developer conveniences ---
|
|
# compile_commands.json for clangd (bear if present, else Makefile-derived).
|
|
compile-commands:
|
|
./scripts/gen-compile-commands.sh
|
|
|
|
# Make the code confess to the style guide.
|
|
format:
|
|
clang-format -i $(fastwc_SOURCES)
|
|
|
|
# Verify the code already confesses, without touching it.
|
|
format-check:
|
|
clang-format --dry-run --Werror $(fastwc_SOURCES)
|
|
|
|
# Static analysis via clang-tidy (needs compile_commands.json).
|
|
# Warnings are errors: the style guide is the law.
|
|
lint: compile-commands
|
|
clang-tidy -p . --warnings-as-errors='*' $(fastwc_SOURCES)
|
|
|
|
clean-local:
|
|
rm -rf bin
|
|
|
|
.PHONY: release bench compile-commands format format-check lint
|