Skip to content

Commit 36ad315

Browse files
authored
test parsnip "overhead" (#1071)
1 parent 60f97cd commit 36ad315

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
needs: check
5757

5858
- name: Install dev reticulate
59-
run: pak::pkg_install('reticulate')
59+
run: pak::pkg_install('rstudio/reticulate')
6060
shell: Rscript {0}
6161

6262
- name: Install Miniconda

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Imports:
4040
withr
4141
Suggests:
4242
C50,
43+
bench,
4344
covr,
4445
dials (>= 1.1.0),
4546
earth,

tests/testthat/test_fit_interfaces.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,20 @@ test_that("fit() can handle attributes on a vector outcome", {
154154
ignore_attr = TRUE
155155
)
156156
})
157+
158+
test_that("overhead of parsnip interface is minimal (#1071)", {
159+
skip_on_cran()
160+
skip_on_covr()
161+
skip_if_not_installed("bench")
162+
163+
bm <- bench::mark(
164+
time_engine = lm(mpg ~ ., mtcars),
165+
time_parsnip_form = fit(linear_reg(), mpg ~ ., mtcars),
166+
time_parsnip_xy = fit_xy(linear_reg(), mtcars[2:11], mtcars[1]),
167+
relative = TRUE,
168+
check = FALSE
169+
)
170+
171+
expect_true(bm$median[2] < 3, label = "parsnip overhead is minimal (formula interface)")
172+
expect_true(bm$median[3] < 3.5, , label = "parsnip overhead is minimal (xy interface)")
173+
})

0 commit comments

Comments
 (0)