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,
Bases:
ReporterClass 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, andcallbackwith the default target beingconsole.- Variables:
name (str) – The unique identifying name of the reporter.
description (str) – A brief description of the reporter.
choices (Choices) – A collection of
Choicesinstances defining the reporter instance, CLI flags,Choicename, supportedSectionobjects, supported outputTargetobjects, and supported outputFormatobjects for the reporter.
Initialize the RichTableReporter.
Note
The exception documentation below refers to validation of subclass configuration class variables
_OPTIONS_TYPEand_OPTIONS_KWARGS. These must be correctly defined in any subclass ofRichTableReporterto ensure proper functionality.In simple use, these exceptions should never be raised, as
RichTableReporterprovides 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:
SimpleBenchTypeError – If the subclass configuration types are invalid.
SimpleBenchValueError – If the subclass configuration values are invalid.
- render(
- *,
- case: Case,
- section: Section,
- options: ReporterOptions,
Prints the benchmark results in a rich table format if available.
It creates a
Tableinstance 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
Caseinstance representing the benchmarked code.options – The options specifying the report configuration. (
RichTableOptionsis a subclass ofReporterOptions.)section – The
Sectionenum value specifying the type of results to display.
- Returns:
The
Tableinstance.