Open
Description
I have noticed there is a considerable overhead when using handler_cli
. For example,
f <- function(R = 1000) {
pb <- progressr::progressor(steps = R)
onerun <- function(...) {
pb()
Sys.sleep(0.001)
}
system.time(lapply(seq_len(R), onerun))
}
progressr::handlers(progressr::handler_progress)
f() |> print()
## user system elapsed
## 1.594 0.023 2.879
compared to
progressr::handlers(progressr::handler_cli)
f() |> print()
## user system elapsed
## 9.058 0.021 10.352
Is this something that could be fixed, or perhaps this need to be taken up with the cli
maintainer?
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin22.6.0 (64-bit)
Running under: macOS Sonoma 14.3.1
Matrix products: default
BLAS: /Users/kkzh/.asdf/installs/R/4.3.2/lib/R/lib/libRblas.dylib
LAPACK: /Users/kkzh/.asdf/installs/R/4.3.2/lib/R/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/Copenhagen
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.3.2 R6_2.5.1 cli_3.6.2 hms_1.1.3
[5] prettyunits_1.2.0 crayon_1.5.2 vctrs_0.6.5 progress_1.2.3
[9] progressr_0.14.0 digest_0.6.34 lifecycle_1.0.4 pkgconfig_2.0.3
[13] rlang_1.1.3