Module thyme::bench

source ·
Expand description

Simple benchmarking functionality for supporting thyme.

Benchmarks consist of a moving average and associated statistics of a given set of timings. Timings that are grouped together share the same tag. You can pass a block to be timed using run, or create a handle with start and end the timing with end. Use stats to get a Stats, which is the primary interface for reporting on the timings.

Structs

  • A benchmarking handle created by start. end this to finish the given benchmark timing
  • Statistics associated with a given set of benchmark timings. These are obtained with the stats method for a given tag. Statistics are for a moving average of the last N timings for the tag, where N is currently hardcoded to 30.

Functions

  • A convenience method to automatically generate a report String for the given tag. The report will include all of the data in the Stats associated with this tag, and be formatted with appropriate units. Limits to a number of recent samples if there are a large number of total samples.
  • Like report, but there is no limit on the number of samples to be considered.
  • Runs the specified closure block as a benchmark timing with the given tag.
  • Like report, but produces a condensed version of the data.
  • Starts a benchmark timing with the given tag. You must end the returned Handle to complete the timing.
  • Returns a Stats object for the benchmark timings associated with the given tag. Limits to a number of recent samples if there are a large number of total samples.
  • Like stats, but there is no limit on the number of samples to be considered.