simplebench.reporters.rich_table.reporter.reporter module🔗

Reporter for benchmark results using Rich tables on the console.

class simplebench.reporters.rich_table.reporter.reporter.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.

Initialize the RichTableReporter.

Note

The exception documentation below refers to validation of subclass configuration class variables _OPTIONS_TYPE and _OPTIONS_KWARGS. These must be correctly defined in any subclass of RichTableReporter to ensure proper functionality.

In simple use, these exceptions should never be raised, as RichTableReporter provides valid implementations. They are documented here for completeness.

Parameters:

config (RichTableConfig | None) – An optional configuration object to override default reporter settings. If not provided, default settings will be used.

Raises:
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.

The table includes the fields specified in the options argument, formatted appropriately based on the results data.

Depending on the options, variation columns can be placed at the start or end of the rows.

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.