---
title: "rBiasCorrection: Benchmarking"
date: "`r Sys.Date()`"
vignette: >
  %\VignetteIndexEntry{rBiasCorrection_enchmarking}
  %\VignetteEncoding{UTF-8}
  %\VignetteEngine{quarto::html}
editor_options: 
  chunk_output_type: console
execute:
  eval: false
  collapse: true
  comment: "#>"
---

```{r, include = FALSE}
plotdir <- paste0(tempdir(), "/png/")
csvdir <- paste0(tempdir(), "/csv/")
dir.create(plotdir)
dir.create(csvdir)

# benchmarking times
times <- 10
```

```{r}
library(rBiasCorrection)

samplelocusname <- "CDH1"
seed <- 1234


data.table::fwrite(
  rBiasCorrection::example.data_experimental$dat,
  paste0(tempdir(), "/experimental_data.csv")
)
data.table::fwrite(
  rBiasCorrection::example.data_calibration$dat,
  paste0(tempdir(), "/calibration_data.csv")
)

experimental <- paste0(tempdir(), "/experimental_data.csv")
calibration <- paste0(tempdir(), "/calibration_data.csv")
```


# Available Cores

```{r warning=FALSE}
future::availableCores()
```

# Benchmarking

```{r results='hide', message=FALSE, warning=FALSE, error=FALSE}
results_multi <- microbenchmark::microbenchmark({
  rBiasCorrection::biascorrection(
    experimental = experimental,
    calibration = calibration,
    samplelocusname = samplelocusname,
    plotdir = plotdir,
    csvdir = csvdir,
    seed = seed
  )},
  times = times
)
```

```{r}
results_multi
```
