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.


krlmlr/styler documentation built on April 8, 2024, 7:53 p.m.