simplebench.reporters.rich_table package🔗

Rich Table Reporter for SimpleBench.

class simplebench.reporters.rich_table.RichTableOptions(virtual_width: int | None = None)[source]🔗

Bases: ReporterOptions

Class for holding Rich table reporter specific options in a Choice.

This class provides additional configuration options specific to the JSON reporter. It is accessed via the options attribute of a Choice instance.

Variables:

virtual_width (int, optional) –

The width of the Rich table output in characters when rendered to the filesystem or via callback. Must be between 80 and 1000 characters or None. If None, no width constraint is applied.

The virtual width is used to determine how the table should be formatted when rendered to non-console outputs, such as files or callbacks. This allows for better control over the appearance of the table in different contexts.

property virtual_width: int | None🔗

Return the virtual width of the Rich table output.

The virtual width is used when rendered to the filesystem or via callback.

Returns:

The virtual width of the Rich table output in characters.

Return type:

int, optional

class simplebench.reporters.rich_table.RichTableReporter(
config: RichTableConfig | None = None,
)[source]🔗

Bases: Reporter

Class for outputting benchmark results as Rich Tables.

It supports reporting operations per second and per round timing results, either separately or together, to the console, to files, and/or via a callback function.

Defined command-line flags:

  • --rich-table: Outputs all results as rich text tables on the console.

  • --rich-table.ops: Outputs only operations per second results.

  • --rich-table.timings: Outputs only per round timing results.

  • --rich-table.memory: Outputs only memory usage results.

  • --rich-table.peak-memory: Outputs only peak memory usage results.

Each flag supports multiple targets: console, filesystem, and callback with the default target being console.

Variables:
  • name (str) – The unique identifying name of the reporter.

  • description (str) – A brief description of the reporter.

  • choices (Choices) – A collection of Choices instances defining the reporter instance, CLI flags, Choice name, supported Section objects, supported output Target objects, and supported output Format objects for the reporter.

render(
*,
case: Case,
section: Section,
options: ReporterOptions,
) Table[source]🔗

Prints the benchmark results in a rich table format if available.

It creates a Table instance containing the benchmark results for the specified section.

Parameters:
  • case – The Case instance representing the benchmarked code.

  • options – The options specifying the report configuration. (RichTableOptions is a subclass of ReporterOptions.)

  • section – The Section enum value specifying the type of results to display.

Returns:

The Table instance.

Subpackages🔗