Closed DavisVaughan closed 1 year ago
These call parse() which defaults to keep.source = TRUE, but you typically don't need that and it is super slow. It ends up calling srcfilecopy() which even calls getwd() internally!
parse()
keep.source = TRUE
srcfilecopy()
getwd()
bench::mark(parse(text = "x"), parse(text = "x", keep.source = F), check = F) #> # A tibble: 2 × 6 #> expression min median `itr/sec` mem_a…¹ gc/se…² #> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:b> <dbl> #> 1 parse(text = "x") 47.53µs 51.3µs 17793. 280B 4.04 #> 2 parse(text = "x", keep.source = F) 3.01µs 3.87µs 256832. 0B 25.7 #> # … with abbreviated variable names ¹mem_alloc, ²`gc/sec`
Consider defaulting keep_source to FALSE? Not sure how important the sources are in typical usage of this function.
keep_source
FALSE
These call
parse()
which defaults tokeep.source = TRUE
, but you typically don't need that and it is super slow. It ends up callingsrcfilecopy()
which even callsgetwd()
internally!Consider defaulting
keep_source
toFALSE
? Not sure how important the sources are in typical usage of this function.