Learn R Programming

PubChemR (version 3.0.0)

pc_benchmark_harness: Benchmark Harness for Scale Scenarios

Description

Executes benchmark scenarios (defaults: 10, 1000, 100000 identifiers), evaluates threshold gates, and optionally writes a report artifact.

Usage

pc_benchmark_harness(
  fn,
  ids = NULL,
  scenario_sizes = c(10L, 1000L, 100000L),
  id_generator = NULL,
  chunk_sizes = c(25L, 100L, 1000L),
  parallel_options = c(FALSE),
  workers = NULL,
  thresholds = pc_default_benchmark_thresholds(),
  report_path = NULL,
  report_format = c("markdown", "csv", "rds"),
  ...
)

Value

An object of class `PubChemBenchmarkReport` containing `details` and `summary` tibbles.

Arguments

fn

Function applied by `pc_batch()`/`pc_benchmark()`.

ids

Optional base identifier vector. If shorter than a scenario size, identifiers are recycled.

scenario_sizes

Integer vector of benchmark scenario sizes.

id_generator

Optional function `function(n)` returning `n` identifiers.

chunk_sizes

Integer vector of chunk sizes evaluated per scenario.

parallel_options

Logical vector controlling parallel toggle.

workers

Number of workers used when parallel is enabled.

thresholds

Named list with optional elements `elapsed_sec` and `failed_chunk_ratio`. Each can be scalar or a named numeric vector keyed by scenario size.

report_path

Optional path to write report output.

report_format

One of `"markdown"`, `"csv"`, or `"rds"`.

...

Additional arguments passed to `fn`.

Details

Scenario-level summaries include elapsed-time and failed-chunk-ratio gates, making this helper useful for CI performance regression checks.

Examples

Run this code
report <- pc_benchmark_harness(
  fn = function(chunk_ids, ...) sum(chunk_ids),
  ids = 1:50,
  scenario_sizes = c(10L, 20L),
  chunk_sizes = c(5L),
  parallel_options = FALSE
)
class(report)

Run the code above in your browser using DataLab