Files
vlibc/benchmarks
huntedbytheirsandSisyphus 53c8531eab bench(string): add bench_string.c vs glibc/musl
System-headers-only harness timing the five L1 string functions
(strlen, strcmp, memcpy, memmove, memset) at 8- and 64-byte inputs.
Calls go through volatile function pointers to defeat builtin
substitution and LICM hoisting; correctness self-asserts route through
the same pointers. Prints FUNC@SIZE ns/call lines.

bench_string uses empty per-target CPPFLAGS (no -I include) so it links
against whichever libc --with-libc= selects; the bench target runs it
always and bench_vlibc only under BENCH_LINK_VLIBC. Both programs
relink when config.status changes, so a reconfigure cannot silently
reuse a binary from the previous libc.

Measured vs glibc 2.44 (median of 3 runs): mem* 1.0-3.3x,
strlen/strcmp 3.2-3.9x — word-at-a-time vs AVX2, all sane.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
2026-08-31 21:28:04 -04:00
..

Benchmarking

Every vlibc component is benchmarked against the software it replaces, per musts/BENCHMARKING.md. A component that is slower or worse at its task than the software it replaces is considered failing.

Layout

  • Each benchmark harness is a standalone C program in this directory, named bench_<component>.c.
  • bench_vlibc.c is the skeleton that per-component benchmarks build on.

Running

./autogen.sh                  # configure (default: link against vlibc)
make bench                    # build and run the harnesses

# Reference comparison against the libc vlibc replaces:
./autogen.sh --with-libc=glibc
make bench

# musl reference (requires musl-gcc):
./autogen.sh --with-libc=musl
make bench

Adding a benchmark

  1. Add bench_<component>.c here and list it in benchmarks/Makefile.am.
  2. Measure the component against the equivalent glibc (and musl) call.
  3. Report wall-clock time, throughput, and any binary-size difference.
  4. If vlibc is slower, the benchmark fails — fix the implementation.