Skip to content

Results¤

Serializable benchmark result containers with typed fields for throughput, latency, and resource metrics.

See Also¤


calibrax.core.result ¤

Unified benchmark result container.

Composes TimingSample, ResourceSummary, and Metric into a single serializable BenchmarkResult with JSON save/load support.

BenchmarkResult dataclass ¤

BenchmarkResult(*, name: str, domain: str = '', tags: dict[str, str] = dict(), timing: TimingSample | None = None, resources: ResourceSummary | None = None, metrics: dict[str, Metric] = dict(), metadata: dict[str, Any] = dict(), config: dict[str, Any] = dict(), timestamp: float = time())

Framework-agnostic benchmark result.

Composes timing, resource, and metric measurements into a single serializable container for cross-framework comparison.

Attributes:

Name Type Description
name str

Benchmark name identifier.

domain str

Domain category (e.g., "computer_vision", "nlp").

tags dict[str, str]

Flexible key-value tags (framework, model, variant, etc.).

timing TimingSample | None

Timing measurements from TimingCollector.

resources ResourceSummary | None

Resource usage from ResourceMonitor.

metrics dict[str, Metric]

Named metric values with optional confidence intervals.

metadata dict[str, Any]

Additional metadata (system info, hyperparameters, etc.).

config dict[str, Any]

Benchmark configuration parameters.

timestamp float

Unix timestamp of the benchmark run.

name instance-attribute ¤

name: str

domain class-attribute instance-attribute ¤

domain: str = ''

tags class-attribute instance-attribute ¤

tags: dict[str, str] = field(default_factory=dict)

timing class-attribute instance-attribute ¤

timing: TimingSample | None = None

resources class-attribute instance-attribute ¤

resources: ResourceSummary | None = None

metrics class-attribute instance-attribute ¤

metrics: dict[str, Metric] = field(default_factory=dict)

metadata class-attribute instance-attribute ¤

metadata: dict[str, Any] = field(default_factory=dict)

config class-attribute instance-attribute ¤

config: dict[str, Any] = field(default_factory=dict)

timestamp class-attribute instance-attribute ¤

timestamp: float = field(default_factory=time)

to_dict ¤

to_dict() -> dict[str, Any]

Serialize to a JSON-compatible dictionary.

Returns:

Type Description
dict[str, Any]

Dictionary representation with nested objects serialized.

from_dict classmethod ¤

from_dict(data: dict[str, Any]) -> BenchmarkResult

Deserialize from a dictionary.

Parameters:

Name Type Description Default
data dict[str, Any]

Dictionary with benchmark result fields.

required

Returns:

Type Description
BenchmarkResult

Reconstructed BenchmarkResult instance.

save ¤

save(filepath: Path) -> None

Save result to a JSON file, creating parent directories.

Parameters:

Name Type Description Default
filepath Path

Path to the output JSON file.

required

load classmethod ¤

load(filepath: Path) -> BenchmarkResult

Load a BenchmarkResult from a JSON file.

Parameters:

Name Type Description Default
filepath Path

Path to the JSON file.

required

Returns:

Type Description
BenchmarkResult

Reconstructed BenchmarkResult instance.