simplebench.stats.operation_timings module🔗
Containers for benchmark statistics
- class simplebench.stats.operation_timings.OperationTimings(
- *,
- iterations: Sequence[Iteration] | None = None,
- unit: str = 'ns',
- scale: float = 1e-09,
- rounds: int = 1,
- data: Sequence[int | float] | None = None,
Bases:
StatsContainer for the operation timing statistics of a benchmark.
- Variables:
unit (str) – The unit of measurement for the timings (e.g., “ns”).
scale (float) – The scale factor for the timings (e.g., “1e-9” for nanoseconds).
rounds (int) – The number of data points in the benchmark.
data (tuple[int | float, ...]) – Tuple of timing data points.
mean (float) – The mean time per operation.
median (float) – The median time per operation.
minimum (float) – The minimum time per operation.
maximum (float) – The maximum time per operation.
standard_deviation (float) – The standard deviation of the time per operation.
relative_standard_deviation (float) – The relative standard deviation of the time per operation.
percentiles (dict[int, float]) – Percentiles of time per operation.
Construct OperationTimings stats from Iteration or raw timing data.
- Parameters:
iterations – Sequence of
Iterationobjects to extract timing data from.unit – The unit of measurement for the timings (e.g., “ns”).
scale – The scale factor for the timings (e.g., “1e-9” for nanoseconds).
rounds – The number of data points in the benchmark.
data – Optional sequence of timing data points. If not provided, timing data will be extracted from the iterations if available.
- Raises:
SimpleBenchTypeError – If any of the arguments are of the wrong type.
SimpleBenchValueError – If any of the arguments have invalid values.
- class simplebench.stats.operation_timings.OperationTimingsSummary(
- *,
- unit: str,
- scale: float,
- rounds: int,
- mean: float,
- median: float,
- minimum: float,
- maximum: float,
- standard_deviation: float,
- relative_standard_deviation: float,
- percentiles: tuple[float, ...],
Bases:
StatsSummaryContainer for summary of operation timing statistics of a benchmark.
- Variables:
unit (str) – The unit of measurement for the benchmark (e.g., “ops/s”).
scale (float) – The scale factor for the interval (e.g. 1 for seconds).
rounds (int) – The number of data points in the benchmark.
mean (float) – The mean operations per time interval.
median (float) – The median operations per time interval.
minimum (float) – The minimum operations per time interval.
maximum (float) – The maximum operations per time interval.
standard_deviation (float) – The standard deviation of operations per time interval.
relative_standard_deviation (float) – The relative standard deviation of ops per time interval.
percentiles (dict[int, float]) – Percentiles of operations per time interval.
Initialize the StatsSummary object.
- Parameters:
unit (str) – The unit of measurement for the data (e.g., “ops/s”).
scale (float) – The scale factor the data (e.g. 1.0 for seconds).
rounds (int) – The number of rounds each data point represents.
mean (float) – The mean data point.
median (float) – The median data point.
minimum (float) – The minimum data point.
maximum (float) – The maximum data point.
standard_deviation (float) – The standard deviation of data.
relative_standard_deviation (float) – The relative standard deviation of data.
- Raises:
SimpleBenchTypeError – If any of the arguments are of the wrong type.
SimpleBenchValueError – If any of the arguments have invalid values.