Files
bux-lang/benches/README.md
T
dimgigov eb81856565 feat: HTTP registry, app/bench harnesses, and DWARF #line maps
Ship QUALITY_PLAN sessions 31–33: fetchable package index URLs, showcase
app and micro/nexus benchmarks, and debugger-friendly C codegen.

- Registry: BUX_REGISTRY accepts http(s) URLs (curl/wget → ~/.bux/cache)
- E.2: make test-apps smoke for nexus/boko/simpledb/jwt-pitbul
- E.5: benches/micro + C/Nim/Zig twins; make bench-nexus (wrk)
- E.4: HIR locs → #line .bux; default -O0 -g; --release -O2; make test-dwarf
2026-07-19 22:46:45 +03:00

57 lines
1.6 KiB
Markdown

# Bux benchmarks (E.5)
Micro-kernels + optional Nexus HTTP throughput for regression and language comparison.
## Quick run
```bash
# From repo root
make bench # Bux micro + C + Nim (+ Zig if installed)
make bench-nexus # wrk vs apps/nexus /api/health
BENCH_NEXUS=1 make bench
```
## Micro suites
| Suite | Kernels | Build |
|-------|---------|-------|
| `micro/` | Bux: `int_loop`, `fib30`, `string_concat`, `array_push` | `buxc build` |
| `c/` | C: `fib30`, `int_loop` | `gcc -O2` |
| `nim/` | Nim twins | `nim c -d:release --opt:speed` |
| `zig/` | Zig twins (optional) | `zig build-exe -OReleaseFast` |
Output lines:
```
BENCH <name> iters=N total_us=T us_per_op=P
```
## Nexus throughput
`tools/bench_nexus.sh` / `make bench-nexus`:
1. Builds `apps/nexus`
2. Starts on `NEXUS_PORT` (default **18080**), bind `127.0.0.1`
3. `wrk -t4 -c64 -d5s` against `/api/health`
4. Prints `BENCH nexus_health rps=…`
Env knobs:
| Variable | Default | Meaning |
|----------|---------|---------|
| `NEXUS_PORT` | `18080` | Listen port (also used by the server binary) |
| `NEXUS_WORKERS` | `4` | Worker threads |
| `NEXUS_BENCH_DURATION` | `5s` | wrk `-d` |
| `NEXUS_BENCH_C` | `64` | wrk connections |
| `NEXUS_BENCH_T` | `4` | wrk threads |
Server-side (any nexus run):
- `NEXUS_PORT`, `NEXUS_WORKERS`, `NEXUS_BIND`, `NEXUS_PUBLIC`
## Notes
- Numbers vary by machine; use them relatively (same host, same day).
- Nexus currently closes connections (`Connection: close`) — RPS is honest for that model, not keep-alive maxed.
- Requires `wrk` for `bench-nexus` (`apt install wrk` on Debian/Ubuntu).