simplebench.stats.peak_memory_usage module🔗

Containers for benchmark statistics

class simplebench.stats.peak_memory_usage.PeakMemoryUsage(
*,
iterations: Sequence[Iteration] | None = None,
unit: str = 'bytes',
scale: float = 1.0,
rounds: int = 1,
data: Sequence[int | float] | None = None,
)[source]🔗

Bases: Stats

Container for the peak memory usage statistics of a benchmark.

Variables:
  • unit (str) – The unit of measurement for the memory usage (e.g., “MB”).

  • scale (float) – The scale factor for the memory usage (e.g., “1e6” for megabytes).

  • rounds (int) – The number of data points in the benchmark.

  • data (tuple[int | float, ...]) – Tuple of peak memory usage data points.

  • mean (float) – The mean memory usage.

  • median (float) – The median memory usage.

  • minimum (float) – The minimum memory usage.

  • maximum (float) – The maximum memory usage.

  • standard_deviation (float) – The standard deviation of the memory usage.

  • relative_standard_deviation (float) – The relative standard deviation of the memory usage.

  • percentiles (dict[int, float]) – Percentiles of memory usage.

Construct PeakMemoryUsage stats from Iteration or raw memory data.

Parameters:
  • iterations – Sequence of Iteration objects to extract peak memory data from.

  • unit – The unit of measurement for the memory usage (e.g., “MB”).

  • scale – The scale factor for the memory usage (e.g., “1e6” for megabytes).

  • rounds – The number of data points in the benchmark.

  • data – Optional Sequence of peak memory usage data points. If not provided, peak memory data will be extracted from the iterations if available.

Raises:
class simplebench.stats.peak_memory_usage.PeakMemoryUsageSummary(
*,
unit: str,
scale: float,
rounds: int,
mean: float,
median: float,
minimum: float,
maximum: float,
standard_deviation: float,
relative_standard_deviation: float,
percentiles: tuple[float, ...],
)[source]🔗

Bases: StatsSummary

Container for the summary of peak memory usage statistics of a benchmark.

Variables:
  • unit (str) – The unit of measurement for the memory usage (e.g., “MB”).

  • scale (float) – The scale factor for the memory usage (e.g., “1e6” for megabytes).

  • rounds (int) – The number of data points in the benchmark.

  • mean (float) – The mean memory usage.

  • median (float) – The median memory usage.

  • minimum (float) – The minimum memory usage.

  • maximum (float) – The maximum memory usage.

  • standard_deviation (float) – The standard deviation of the memory usage.

  • relative_standard_deviation (float) – The relative standard deviation of the memory usage.

  • percentiles (dict[int, float]) – Percentiles of memory usage.

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.

  • percentiles (tuple[float, ...]) – Percentiles of data.

Raises: