Files
nfs/docs/_results/2026-09-22-readdir-page.md
T
petrbalvin a9b8039ef7
Test / test (push) Successful in 2m4s
Release / gates (push) Successful in 2m5s
Release / build (amd64, freebsd) (push) Successful in 1m27s
Release / build (amd64, linux) (push) Successful in 1m22s
Release / build (amd64, netbsd) (push) Successful in 1m19s
Release / build (amd64, openbsd) (push) Successful in 1m20s
Release / build (arm64, darwin) (push) Successful in 1m21s
Release / build (arm64, freebsd) (push) Successful in 1m26s
Release / build (arm64, linux) (push) Successful in 1m25s
Release / build (arm64, netbsd) (push) Successful in 1m31s
Release / build (arm64, openbsd) (push) Successful in 1m27s
Release / build (loong64, linux) (push) Successful in 1m37s
Release / build (riscv64, linux) (push) Successful in 1m21s
Release / release (push) Successful in 40s
feat: full NFSv4.2 server and client in pure Go
Assisted-by: GLM 5.3 Flash
2026-09-21 18:51:17 +02:00

1.1 KiB

Measurement: the paginated READDIR

  • Date: 2026-09-22
  • Machine: AMD Ryzen AI Max+ Pro 395 (32 threads), otherwise idle
  • Toolchain: go1.27.1, no build flags
  • Command: go test ./internal/nfsfs/ -run '^$' -bench=ReadDirPage -benchmem -count=1 -benchtime=50x

Baseline

The commit 340783e, measured in the same session as the new code. The benchmark pages a 10 000 entry directory 64 entries at a time, which is the shape of a client listing a large directory through READDIR pages: the baseline re listed and re sorted the whole directory for every page.

Result

Median free, 50 iterations per side, one session.

Benchmark Baseline With the listing cache Change
BenchmarkReadDirPage64 1863611 ns/op, 1402 KiB/op, 20290 allocs/op 62506 ns/op, 40 KiB/op, 267 allocs/op -96.6 %

A page of 64 costs 30 times less once the sorted order is cached and revalidated against the directory's modification time, and the cost no longer grows with the size of the directory: the numbers above are the boundary case, where a page paid for listing and sorting ten thousand names to serve sixty four of them.