I was investigating https://github.com/tidyverse/dplyr/issues/6897 with dev lifecycle installed and discovered a lot of the remaining time spent in repeated calls to deprecate_soft() and deprecate_warn() with always = FALSE is in generating the trace_back(), which we throw away every single time except for the very first one.
I've moved the trace_back() call after our early exit, which cuts the time for deprecate_soft() in half again
# trigger it once
lifecycle::deprecate_soft("1.1.0", "fn()", "fn2()")
f <- function() {
lifecycle::deprecate_soft("1.1.0", "fn()", "fn2()")
}
g <- function() {
for (i in 1:1000) {
f()
}
}
bench::system_time(g())
Follow up on https://github.com/r-lib/lifecycle/pull/172
I was investigating https://github.com/tidyverse/dplyr/issues/6897 with dev lifecycle installed and discovered a lot of the remaining time spent in repeated calls to
deprecate_soft()
anddeprecate_warn()
withalways = FALSE
is in generating thetrace_back()
, which we throw away every single time except for the very first one.I've moved the
trace_back()
call after our early exit, which cuts the time fordeprecate_soft()
in half againCurrent dev main
This PR