n_times_faster_with_cache: Times two function calls with temporarily enabled cache

View source: R/testing.R

n_times_faster_with_cacheR Documentation

Times two function calls with temporarily enabled cache

Description

This can be helpful for benchmarking.

Usage

n_times_faster_with_cache(
  x1,
  x2 = x1,
  ...,
  fun = styler::style_text,
  n = 3L,
  clear = "always"
)

Arguments

...

Arguments passed to fun.

fun

The function that should be timed.

n

The number of times the experiment should be repeated.

Value

A scalar indicating the relative difference of the second compared to the first run.


r-lib/styler documentation built on Dec. 13, 2024, 5:42 p.m.