Closed simonpcouch closed 1 year ago
As of now, the package re-computes format_params(x) in each replicate, which accounts for about half of the total evaluation time of the function.
format_params(x)
With main dev:
main
library(infer) gss_hyp <- gss %>% specify(response = sex, success = "female") %>% hypothesize(null = "point", p = .5) bench::mark( generate = generate(gss_hyp, reps = 1000, type = "draw") ) #> # A tibble: 1 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> #> 1 generate 58.4ms 61.7ms 15.2 42.5MB 30.4
With 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 generate 33.5ms 33.5ms 29.9 40.5MB 747.
Created on 2023-04-10 with reprex v2.0.2
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.
As of now, the package re-computes
format_params(x)
in each replicate, which accounts for about half of the total evaluation time of the function.With
main
dev:With this PR:
Created on 2023-04-10 with reprex v2.0.2