cuprate-hinto-janai/benches
2024-06-26 15:43:05 -04:00
..
README.md add readme 2024-06-26 15:43:05 -04:00

Benches

This directory contains 3 sub-directories:

Sub-directory Purpose
micro/ Micro-benchmarks for crates (e.g. timings for a single function)
macro/ Macro-benchmarks for whole crates or sub-systems (using Cuprate's custom benchmarking harness)
harness/ Cuprate's custom benchmarking harness

Harness

The harness is just another crate (that happens to be for benchmarking).

Conceptually, it's purpose is very simple:

  1. Set-up the benchmark
  2. Start timer
  3. Run benchmark
  4. Output data

This single harness runs the benchmarks found in macro/.

The way benchmarks "plug-in" to the harness is simply by implementing trait Benchmark.

See cuprate-harness' crate documentation for a user-guide:

cargo doc --open --package cuprate-harness

Macro

Each sub-directory in here is a crate that plugs into the harness.

Benchmarks in macro/ are for testing sub-systems and/or sections of a sub-system, e.g. the block downloader, the RPC server, the database, etc.

See macro/cuprate-database for an example.

Micro

Each sub-directory in here is a crate that uses Criterion for timing single functions, groups of functions.

They are generally be small in scope.

See macro/cuprate-json-rpc for an example.