mirror of
https://github.com/luxfi/bench.git
synced 2026-10-30 17:01:57 +00:00
github.com/luxfi/bench existed only as loose files: no .git, no history, no
remote. An rm -rf would have destroyed it with nothing to recover from, and it
was invisible to every repo sweep that looks for a .git directory.
Includes the dependency repair that makes it build again. It previously failed
with:
reading github.com/luxfi/geth/go.mod at revision v1.16.98: unknown revision
The v1.16.x line was DELETED from github.com/luxfi/geth. The requirement came
from github.com/luxfi/crypto, which pins the dead tag AND excludes the
alternative in every version through v1.20.0; v1.20.2 is the first that moved
to geth v1.20.1, so bumping crypto is what escapes it. geth then drops out of
go.mod entirely.
The compiled luxbench binary is ignored rather than committed.
Verified: go build ./... exits 0.
NOTE: no remote — luxfi/bench does not exist on GitHub. This is still one copy
in one place.
2.0 KiB
2.0 KiB
bench — luxbench unified harness
Single bench driver for the luxfi stack. Replaces the ad-hoc
/tmp/<name>-bench/ directories.
Layout
bench/
├── cmd/luxbench/ # CLI entry: flag parsing + mode dispatch
├── mode.go # Mode interface (Name/Description/RegisterFlags/Run)
├── modes/
│ ├── zap_vs_codec/ # CANARY: 8 head-to-head linearcodec vs zap claims
│ ├── gpu/ # scaffold (TODO: port /tmp/spark-gpu-bench/)
│ ├── multi_validator/ # scaffold (TODO: port /tmp/multi-validator/)
│ ├── parity/ # scaffold (TODO: port lux/threshold/protocols/parity/)
│ └── matrix/ # scaffold (TODO: 7-profile sig-pack matrix)
├── result/schema.go # ResultRecord + File envelope + JSON IO + quantiles
└── README.md # user-facing docs
Invariants
- One harness. No new
/tmp/<thing>-bench/directories — every new bench is a mode undermodes/. - One result schema (
result.ResultRecord). Mode-specific metrics go inExtra(snake_case keys). - Modes implement
bench.Mode; CLI dispatches by--mode=<name>. - The CLI owns JSON serialization. Modes return
[]ResultRecord, never write files directly.
Building
cd ~/work/lux/bench && GOWORK=off go build ./...
GOWORK=off go test ./...
GOWORK=off because the harness has its own go.mod with local
replace directives for luxfi/codec and luxfi/zap. Don't add it
to the workspace until the upstream tags catch up.
Canary verification
zap-vs-codec mode produces the same numbers as the original
/tmp/zap-vs-codec/ would have, within run-to-run noise. Deterministic
metrics (B/op, allocs/op) are identical:
GOWORK=off /tmp/luxbench --mode=zap-vs-codec \
--bench='^BenchmarkRejectBadMagic_(Codec|ZAP)$' \
--benchtime=2s --count=3 --output=/tmp/x.json
vs. running go test -bench=... directly in modes/zap_vs_codec/ —
the bench source is the same files, the harness only wraps execution
and parses output.