tidymodels / hardhat

Construct Modeling Packages
https://hardhat.tidymodels.org
Other
101 stars 15 forks source link

Do a pass over `validate_is()` with an eye towards performance #221

Closed DavisVaughan closed 1 year ago

DavisVaughan commented 1 year ago

In particular, avoid eager calls to as_label() and glue() (i.e. validate_is_terms_list_or_null())

use this as a benchmark

library(tidymodels)

set.seed(1)

file <- tempfile(fileext = ".Rprof")

p <- profvis::profvis({
  res <- fit_resamples(linear_reg(), mpg ~ ., bootstraps(mtcars, 100))
}, prof_output = file, interval = .005)

out <- summaryRprof(file)

out_tbl <- tibble::as_tibble(out$by.total, rownames = "fn")

out_tbl %>%
  mutate(fn = gsub("\"", "", fn)) %>%
  arrange(desc(self.pct))
github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.