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

Reprex v2.0.2 does not print all columns of bench::mark() #436

Closed
DesiQuintans opened this issue Mar 11, 2023 · 1 comment
Closed

Reprex v2.0.2 does not print all columns of bench::mark() #436

DesiQuintans opened this issue Mar 11, 2023 · 1 comment

Comments

@DesiQuintans
Copy link

bench::mark() produces a summary tibble with 13 columns, but Reprex only shows the first 6 of them (see first run of mark() in reprex below). It does this even if you select all columns by index or name. The columns really are there (see second run of mark()), it's just that reprex won't print them. It doesn't print any column above 6 even if you specifically select them with mark(...)[, c(1, 7)] (see third run of mark()).

library(bench)
library(dplyr)


mark(
    expr_1 = length(rep(month.name, 1e6)),
    expr_2 = length(rep(month.abb, 1e6))
)

#> # A tibble: 2 × 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 expr_1       51.1ms   57.1ms      16.9    91.6MB     16.9
#> 2 expr_2       55.1ms   56.9ms      17.5    91.6MB     17.5

mark(
    expr_1 = length(rep(month.name, 1e6)),
    expr_2 = length(rep(month.abb, 1e6))
) %>% glimpse()

#> Rows: 2
#> Columns: 13
#> $ expression <bch:expr> <length(rep(month.name, 1e+06))>, <length(rep(month.ab…
#> $ min        <bch:tm> 51.3ms, 55.3ms
#> $ median     <bch:tm> 56.4ms, 58ms
#> $ `itr/sec`  <dbl> 17.52124, 17.01236
#> $ mem_alloc  <bch:byt> 91.6MB, 91.6MB
#> $ `gc/sec`   <dbl> 17.52124, 17.01236
#> $ n_itr      <int> 9, 9
#> $ n_gc       <dbl> 9, 9
#> $ total_time <bch:tm> 514ms, 529ms
#> $ result     <list> 12000000, 12000000
#> $ memory     <list> [<Rprofmem[1 x 3]>], [<Rprofmem[1 x 3]>]
#> $ time       <list> <56.4ms, 56.4ms, 51.3ms, 53.5ms, 53.9ms, 72.4ms, 53.4ms,…
#> $ gc         <list> [<tbl_df[9 x 3]>], [<tbl_df[9 x 3]>]

mark(
    expr_1 = length(month.name),
    expr_2 = length(month.name)
)[, c(1, 7)]

#> # A tibble: 2 × 1
#>   expression
#>   <bch:expr>
#> 1 expr_1    
#> 2 expr_2
@hadley
Copy link
Member

hadley commented Nov 22, 2023

This is a bench feature. The docs say:

#' By default, data columns (result, memory, time, gc) are omitted when
#' printing in knitr. If you would like to include these columns, set the knitr
#' chunk option bench.all_columns = TRUE.

@hadley hadley closed this as completed Nov 22, 2023
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

2 participants