Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add verbose argument to bench::press? #145

Open
tdhock opened this issue Nov 15, 2024 · 0 comments
Open

add verbose argument to bench::press? #145

tdhock opened this issue Nov 15, 2024 · 0 comments

Comments

@tdhock
Copy link

tdhock commented Nov 15, 2024

I expected press() to be silent, but I observe that it prints:

> example("press",package="bench")

press> # Helper function to create a simple data.frame of the specified dimensions
press> create_df <- function(rows, cols) {
press+   as.data.frame(setNames(
press+     replicate(cols, runif(rows, 1, 1000), simplify = FALSE),
press+     rep_len(c("x", letters), cols)))
press+ }

press> # Run 4 data sizes across 3 samples with 2 replicates (24 total benchmarks)
press> press(
press+   rows = c(1000, 10000),
press+   cols = c(10, 100),
press+   rep = 1:2,
press+   {
press+     dat <- create_df(rows, cols)
press+     bench::mark(
press+       min_time = .05,
press+       bracket = dat[dat$x > 500, ],
press+       which = dat[which(dat$x > 500), ],
press+       subset = subset(dat, x > 500)
press+     )
press+   }
press+ )
Running with:
   rows  cols   rep
1  1000    10     1
2 10000    10     1
3  1000   100     1
4 10000   100     1
5  1000    10     2
6 10000    10     2
7  1000   100     2
8 10000   100     2
# A tibble: 24 × 16
   expression  rows  cols   rep      min   median `itr/sec` mem_alloc `gc/sec`
   <bch:expr> <dbl> <dbl> <int> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
 1 bracket     1000    10     1  201.2µs  238.7µs     3769.   116.1KB      0  
 2 which       1000    10     1  125.7µs  192.1µs     5073.   56.18KB     24.6
 3 subset      1000    10     1  179.9µs  278.7µs     2514.  143.81KB      0  
 4 bracket    10000    10     1  905.8µs    1.3ms      778.    1.12MB     25.1
 5 which      10000    10     1    457µs  671.7µs     1458.   565.4KB      0  
 6 subset     10000    10     1  949.3µs   1.44ms      707.    1.24MB     24.4
 7 bracket     1000   100     1  974.4µs   1.55ms      655. 1001.12KB     25.2
 8 which       1000   100     1  946.2µs   1.04ms      903.  407.37KB      0  
 9 subset      1000   100     1  967.1µs    1.7ms      626. 1022.34KB     26.1
10 bracket    10000   100     1   9.35ms   9.79ms      102.    9.81MB     68.0
# ℹ 14 more rows
# ℹ 7 more variables: n_itr <int>, n_gc <dbl>, total_time <bch:tm>,
#   result <list>, memory <list>, time <list>, gc <list>
# ℹ Use `print(n = ...)` to see more rows

issue is "Running with:" and lines below it. Can that printout please be suppressed by default? adding a verbose argument would be appreciated.
Surprisingly, even capture.output does not suppress that output:

> x=capture.output(example("press",package="bench"))
Running with:
   rows  cols   rep
1  1000    10     1
2 10000    10     1
3  1000   100     1
4 10000   100     1
5  1000    10     2
6 10000    10     2
7  1000   100     2
8 10000   100     2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant