Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CLI Reference

Complete reference for the bac-perf command-line tool.

Installation

cargo build --release --package perf-testing

The binary is at target/release/bac-perf.

Commands

generate

Generate HBAC or ABAC rule fixtures for benchmarking.

bac-perf generate [OPTIONS]
OptionDescriptionDefault
--bac-type <TYPE>BAC type: hbac or abachbac
--count <N>Number of rules to generaterequired
--output <NAME>Output fixture namerequired
--distribution <PRESET>Distribution preset: sssd-prod, dev, high-securitysssd-prod
--seed <N>Random seed for reproducibility42
--fixtures-dir <PATH>Fixtures directoryfixtures
# Generate HBAC fixture
bac-perf generate --bac-type hbac --count 1000 --output prod_1k \
  --distribution sssd-prod --seed 42

# Generate ABAC fixture (same distributions)
bac-perf generate --bac-type abac --count 1000 --output abac_1k \
  --distribution sssd-prod --seed 42

bench

Run performance benchmarks against a fixture.

bac-perf bench [OPTIONS]
OptionDescriptionDefault
--bac-type <TYPE>BAC type: hbac or abachbac
--fixture <NAME>Fixture to benchmarkrequired
--scenario <NAME>Benchmark scenarioall
--cacheEnable cachingdisabled
--jitEnable JIT compilation (HBAC only, requires --features jit build)disabled
--format <FORMAT>Output format: terminal, json, csv, markdownterminal
--output <PATH>Save results to filestdout
--fixtures-dir <PATH>Fixtures directoryfixtures

Scenarios:

ScenarioDescription
single-latencyRequest latency with warm cache (10K matching requests)
uncached-latencyRaw evaluation without cache benefit (10K unique requests)
throughputSustained load with 80/20 match/non-match mix
build-timePolicy load and index construction time
allRun all scenarios
# Benchmark HBAC
bac-perf bench --bac-type hbac --fixture prod_1k --scenario all --cache \
  --format json --output results.json

# Benchmark ABAC using HBAC fixture (automatic conversion)
bac-perf bench --bac-type abac --fixture prod_1k --scenario all \
  --format json --output abac_results.json

Note: ABAC can benchmark both ABAC and HBAC fixtures. When using an HBAC fixture with --bac-type abac, rules are automatically converted from the three-dimensional user/host/service model to the equivalent ABAC user/resource/action dimensions. This enables direct performance comparison. See Cross-BAC Benchmarking.

list

List available fixtures.

bac-perf list [OPTIONS]
OptionDescriptionDefault
--verboseShow rule count, size, and generation datesummary only
--fixtures-dir <PATH>Fixtures directoryfixtures
bac-perf list --verbose

compare

Compare two benchmark runs to detect regressions.

bac-perf compare <BASELINE> <CURRENT> [OPTIONS]
ArgumentDescription
<BASELINE>Path to baseline JSON results
<CURRENT>Path to current JSON results
OptionDescriptionDefault
--format <FORMAT>Output format: terminal, markdownterminal
bac-perf compare baseline.json current.json

validate

Check fixture integrity (schema version, JSON structure, rule count consistency).

bac-perf validate <FIXTURE> [OPTIONS]
ArgumentDescription
<FIXTURE>Fixture name to validate
OptionDescriptionDefault
--fixtures-dir <PATH>Fixtures directoryfixtures
bac-perf validate prod_1k

Environment variables

VariableDescription
BAC_PERF_FIXTURES_DIROverride the default fixtures directory
BAC_PERF_OUTPUT_FORMATOverride the default output format
export BAC_PERF_FIXTURES_DIR=/var/lib/bac-perf/fixtures
bac-perf list

Exit codes

CodeMeaning
0Success
1General error (invalid arguments, file not found)
2Validation error (fixture is invalid)
3Benchmark error (evaluation failed)

See also