Closed DavisVaughan closed 1 year ago
To be removed once withr/rlang is released with the faster version of defer() and with_options(), see https://github.com/r-lib/withr/pull/221
defer()
with_options()
library(hardhat) library(tibble) formula <- y ~ a + b df1 <- data.frame(y = 1, a = 2, b = 3) df2 <- tibble(y = 1, a = 2, b = 3) bench::mark(mold(formula, df1), iterations = 10000) # Main #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 mold(formula, df1) 1.33ms 1.73ms 578. 1.74MB 12.0 # This PR #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 mold(formula, df1) 998µs 1.14ms 828. 1.74MB 12.6 bench::mark(mold(formula, df2), iterations = 10000) # Main #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 mold(formula, df2) 1.38ms 1.65ms 590. 2.77KB 13.0 # This PR #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 mold(formula, df2) 972µs 1.19ms 805. 0B 12.9 x <- mold(formula, df1) bench::mark(forge(df1, x$blueprint), iterations = 10000) # Main #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 forge(df1, x$blueprint) 793µs 992µs 985. 352KB 13.3 # This PR #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 forge(df1, x$blueprint) 596µs 724µs 1296. 350KB 12.3 x <- mold(formula, df2) bench::mark(forge(df2, x$blueprint), iterations = 10000) # Main #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 forge(df2, x$blueprint) 823µs 995µs 979. 1.84KB 13.2 # This PR #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 forge(df2, x$blueprint) 567µs 665µs 1432. 0B 13.6
Created on 2023-03-27 with reprex v2.0.2.9000
This pull request 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.
To be removed once withr/rlang is released with the faster version of
defer()
andwith_options()
, see https://github.com/r-lib/withr/pull/221Created on 2023-03-27 with reprex v2.0.2.9000