Skip to content

Commit bca79dc

Browse files
Use touchstone
Add benchmarking vignette Fix touchstone script Fix touchstone script Fix touchstone script Fix touchstone script Fix touchstone script
1 parent fc5652e commit bca79dc

7 files changed

Lines changed: 60 additions & 28 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
^.*\.log$
1919
^touchstone$
2020
^README\.Rmd$
21+
^touchstone$

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ Encoding: UTF-8
4444
Language: en-GB
4545
LazyData: true
4646
Roxygen: list(markdown = TRUE)
47-
RoxygenNote: 7.2.1
47+
RoxygenNote: 7.3.2
4848
SystemRequirements: C++14

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export(make_parameter_file)
1717
export(run_pathomove)
1818
export(use_cluster)
1919
exportClasses(pathomove_output)
20+
import(RcppEigen)
2021
import(data.table)
2122
importFrom(Rcpp,sourceCpp)
2223
importFrom(RcppParallel,RcppParallelLibs)

tests/spelling.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
if(requireNamespace('spelling', quietly = TRUE))
2-
spelling::spell_check_test(vignettes = TRUE, error = FALSE,
3-
skip_on_cran = TRUE)
1+
if (requireNamespace('spelling', quietly = TRUE))
2+
spelling::spell_check_test(
3+
vignettes = TRUE,
4+
error = FALSE,
5+
skip_on_cran = TRUE
6+
)

touchstone/script.R

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
# see `help(run_script, package = 'touchstone')` on how to run this
22
# interactively
33

4-
# TODO OPTIONAL Add directories you want to be available in this file or during the
5-
# benchmarks.
6-
# touchstone::pin_assets("some/dir")
7-
84
# installs branches to benchmark
95
touchstone::branch_install()
106

117
# some setup
12-
genmax <- 10L
13-
g_patho_init <- genmax / 2
14-
initial_infections <- 5L
15-
tmax = 100
16-
popsize = 100
17-
scenario = 1
18-
198
# benchmark a function call from your package (two calls per branch)
209
touchstone::benchmark_run(
21-
# expr_before_benchmark = source("dir/data.R"), #<-- TODO OTPIONAL setup before benchmark
22-
random_test = pathomove::run_pathomove(
10+
expr_before_benchmark = {
11+
genmax <- 100L
12+
g_patho_init <- genmax / 2
13+
initial_infections <- 5L
14+
tmax = 100
15+
popsize = 100
16+
scenario = 1
17+
}, #<-- TODO OTPIONAL setup before benchmark
18+
simple_case = pathomove::run_pathomove(
2319
scenario = scenario,
2420
popsize = popsize,
2521
initialInfections = initial_infections,
@@ -30,16 +26,5 @@ touchstone::benchmark_run(
3026
n = 2
3127
)
3228

33-
# TODO OPTIONAL benchmark any R expression (six calls per branch)
34-
# touchstone::benchmark_run(
35-
# more = {
36-
# if (TRUE) {
37-
# y <- yourpkg::f2(x = 3)
38-
# }
39-
# }, #<- TODO put the call you want to benchmark here
40-
# n = 6
41-
# )
42-
43-
4429
# create artifacts used downstream in the GitHub Action
4530
touchstone::benchmark_analyze()

vignettes/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.html
2+
*.R

vignettes/benchmarking.Rmd

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "benchmarking"
3+
output: rmarkdown::html_vignette
4+
vignette: >
5+
%\VignetteIndexEntry{benchmarking}
6+
%\VignetteEngine{knitr::rmarkdown}
7+
%\VignetteEncoding{UTF-8}
8+
---
9+
10+
```{r, include = FALSE}
11+
knitr::opts_chunk$set(
12+
collapse = TRUE,
13+
comment = "#>"
14+
)
15+
```
16+
17+
```{r setup}
18+
library(pathomove)
19+
```
20+
21+
```{r}
22+
# some setup
23+
genmax <- 10L
24+
g_patho_init <- genmax / 2
25+
initial_infections <- 5L
26+
tmax = 100
27+
popsize = 100
28+
scenario = 1
29+
30+
microbenchmark::microbenchmark(
31+
simple_case = run_pathomove(
32+
scenario = scenario,
33+
popsize = popsize,
34+
initialInfections = initial_infections,
35+
tmax = tmax,
36+
genmax = genmax,
37+
g_patho_init = g_patho_init
38+
)
39+
)
40+
```

0 commit comments

Comments
 (0)