Skip to Content

lacuna.benchmark

Reproducible developer benchmarks.

Generated from Lacuna 0.14.3.

Classes

BenchmarkCase

class BenchmarkCase(
    name: str,
    backend: str,
    median_seconds: float,
    minimum_seconds: float,
    maximum_seconds: float,
    throughput: float,
    throughput_unit: str,
    python_traced_peak_bytes: int,
    checksum: str,
)

One measured public operation with an equivalence checksum.

FieldTypeDefault
namestrrequired
backendstrrequired
median_secondsfloatrequired
minimum_secondsfloatrequired
maximum_secondsfloatrequired
throughputfloatrequired
throughput_unitstrrequired
python_traced_peak_bytesintrequired
checksumstrrequired

BenchmarkCase.to_dict

def to_dict() -> dict[str, object]

Return a JSON-compatible measurement record.

BenchmarkConfig

class BenchmarkConfig(
    periods: int = 40,
    instruments: int = 100,
    horizons: tuple[int, ...] = (1, 5, 20),
    quantiles: int = 5,
    bootstrap_resamples: int = 200,
    repetitions: int = 3,
    warmups: int = 1,
    seed: int = 42,
)

Deterministic dataset and measurement configuration.

FieldTypeDefault
periodsint40
instrumentsint100
horizonstuple[int, ...](1, 5, 20)
quantilesint5
bootstrap_resamplesint200
repetitionsint3
warmupsint1
seedint42

BenchmarkConfig.rows

rows: int

Return rows in each generated panel.

BenchmarkConfig.horizon_names

horizon_names: tuple[str, ...]

Return public trading-observation horizon names.

BenchmarkConfig.to_dict

def to_dict() -> dict[str, object]

Return JSON-compatible resolved configuration.

BenchmarkSuite

class BenchmarkSuite(
    config: BenchmarkConfig,
    cases: tuple[BenchmarkCase, ...],
    generated_at: datetime,
    environment: Mapping[str, object],
    schema_version: str = '1',
    benchmark_version: int = 6,
)

Versioned benchmark artifact; timings are environment-specific evidence.

FieldTypeDefault
configBenchmarkConfigrequired
casestuple[BenchmarkCase, ...]required
generated_atdatetimerequired
environmentMapping[str, object]required
schema_versionstr'1'
benchmark_versionint6

BenchmarkSuite.to_dict

def to_dict() -> dict[str, object]

Return the complete benchmark artifact.

BenchmarkSuite.to_json

def to_json(*, indent: int | None = 2) -> str

Serialize with stable key ordering.

Functions

benchmark_config_for_tier

def benchmark_config_for_tier(
    tier: str,
    *,
    repetitions: int = 3,
    warmups: int = 1,
    seed: int = 42,
) -> BenchmarkConfig

Resolve the committed smoke/small/medium benchmark tiers.

run_benchmarks

def run_benchmarks(
    config: BenchmarkConfig | None = None,
    *,
    use_native: bool = True,
) -> BenchmarkSuite

Measure released public workflows without enforcing machine-specific speed budgets.