silk.bench.render.
Draws a benchmark report as text: a table for a terminal, with optional color, and Markdown.
When to use#
Call Render.terminal or Render.markdown on a silk.bench.record.Report to show a
saved run again, or to put a run in a pull request. silk.bench.bench calls them for the
outputs a suite declares with Format.Terminal and Format.Markdown. Use
silk.bench.html for a page with charts.
Details#
Each benchmark is one table with one row for each implementation: the median time, its 95% interval, the fastest run, the processor time, the peak memory, and the ratio to the reference with its interval and verdict. A table of result lines has the median in the unit of the lines and, in place of the processor time and the memory, one column for each other unit the lines carry. A renderer computes nothing: every number comes from the report.
With color, a ratio is green or red only when its verdict is faster or slower, and dim
when no difference was found. The words stay, so a report without color, or read by someone
who cannot tell the colors apart, says the same.
Import as Render with import silk.bench.render { Render }.
Public declarations: 1.
Render#
pub struct RenderThe owner type of the text renderers. It has no fields and is never constructed.
Implementation Render#
impl RenderAssociated function terminal#
pub effect fn terminal(report: &Report, color: bool) -> String
! OutOfMemoryError
? &mut AllocatorReturns report as a table for a terminal. With color, it holds ANSI escape codes.
Errors#
OutOfMemoryError if the Allocator cannot supply the text.
Associated function markdown#
pub effect fn markdown(report: &Report) -> String
! OutOfMemoryError
? &mut AllocatorReturns report as Markdown: a heading and a table for each benchmark, then the run's
details as a list.
Errors#
OutOfMemoryError if the Allocator cannot supply the text.
Associated function restates#
pub fn restates(report: &Report, chart: &Chart) -> boolReturns the lines that describe the run of report under its tables: the computer, the
dates, the label, the revisions, and the notes.
Errors#
OutOfMemoryError if the Allocator cannot supply the lines.
Returns whether chart says only what the tables of report already say: the median of
every implementation relative to the reference, for each benchmark. The terminal and
Markdown reports leave such a chart out.
Associated function grid#
pub effect fn grid(chart: &Chart, panel: &Panel) -> List<List<String>>
! OutOfMemoryError
? &mut AllocatorReturns panel of chart as the rows of a table, for a renderer that shows a chart as
text: a heading row, then one row for each series with one cell for each entry of the
axis. A distribution gets the columns runs, smallest, largest and spread, where
the spread is a small histogram of the measured runs between the smallest and the largest
value of the panel.
Errors#
OutOfMemoryError if the Allocator cannot supply the cells.
Associated function details#
pub effect fn details(report: &Report) -> List<String>
! OutOfMemoryError
? &mut AllocatorAssociated function titles#
pub effect fn titles(report: &Report, table: &Table) -> List<String>
! OutOfMemoryError
? &mut AllocatorReturns the column titles of table, for a renderer that draws its own table: the
implementation, the median, its interval, the best value, the processor time and peak
memory of a table of process times or one column for each other unit of a table of result
lines, and last the comparison to the reference.
Errors#
OutOfMemoryError if the Allocator cannot supply the titles.
Associated function cells#
pub effect fn cells(report: &Report, table: &Table, row: &Row) -> List<String>
! OutOfMemoryError
? &mut AllocatorReturns the cells of row, a row of table, as text: one for each title of
Render.titles. A row with no successful run has - in every cell between its name and
its comparison.
Errors#
OutOfMemoryError if the Allocator cannot supply the cells.
Associated function memory#
pub effect fn memory(row: &Row, floor: u64) -> String
! OutOfMemoryError
? &mut AllocatorReturns the text of the peak memory column for row, such as 4.20 MiB. A peak that is
not above floor, the smallest the run could see, is written as ≤ 16.6 MiB.
Errors#
OutOfMemoryError if the Allocator cannot supply the text.
Associated function comparison#
pub effect fn comparison(row: &Row) -> String
! OutOfMemoryError
? &mut AllocatorReturns the text of the ratio column for row: reference, - for a row with no
successful run, or the ratio with its interval and verdict, such as
0.49x [0.47, 0.51] faster.
Errors#
OutOfMemoryError if the Allocator cannot supply the text.
Category: Benchmarks.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2, x86_64-pc-windows-msvc, wasm64-unknown-unknown.