Learn R Programming

PubChemR (version 3.0.0)

pc_benchmark: Benchmark Chunked PubChem Workflows

Description

Evaluates `pc_batch()` execution under multiple chunk-size and parallel settings and returns runtime and failure metrics.

Usage

pc_benchmark(
  ids,
  fn,
  chunk_sizes = c(25, 50, 100),
  parallel_options = c(FALSE),
  workers = NULL,
  ...
)

Value

A tibble with runtime and success metrics for each benchmark scenario.

Arguments

ids

Identifier vector.

fn

Function applied by `pc_batch()`.

chunk_sizes

Integer vector of chunk sizes.

parallel_options

Logical vector controlling parallel toggle.

workers

Number of workers used when parallel is enabled.

...

Additional arguments passed to `fn`.

Details

This benchmark is intended for tuning operational parameters before running large production queries.

Examples

Run this code
bm <- pc_benchmark(
  ids = 1:20,
  fn = function(chunk_ids, ...) sum(chunk_ids),
  chunk_sizes = c(5, 10),
  parallel_options = FALSE
)
nrow(bm)

Run the code above in your browser using DataLab