bench icon indicating copy to clipboard operation
bench copied to clipboard

supply more informative axis breaks in `scale_*_bench_*()`

Open simonpcouch opened this issue 11 months ago • 0 comments

Closes #143. I believe that these breaks functions, passed by position, were intended to be passed to scales::trans_new(breaks) rather than scales::trans_new(d_transform).

Here's the reprex from the original issue:

library(ggplot2)
library(bench)

create_df <- function(rows, cols) {
  as.data.frame(setNames(
    replicate(cols, runif(rows, 1, 1000), simplify = FALSE),
    rep_len(c("x", letters), cols)))
}

# Run 4 data sizes across 3 samples with 2 replicates (24 total benchmarks)
bm <- press(
  rows = c(1000, 10000),
  cols = c(10, 100),
  rep = 1:2,
  {
    dat <- create_df(rows, cols)
    bench::mark(
      min_time = .05,
      bracket = dat[dat$x > 500, ],
      which = dat[which(dat$x > 500), ],
      subset = subset(dat, x > 500)
    )
  }
)
#> 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

ggplot(bm) + aes(x = median, y = mem_alloc) + geom_point()
#> Warning: The `trans` argument of `continuous_scale()` is deprecated as of ggplot2 3.5.0.
#> ℹ Please use the `transform` argument instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

Created on 2024-07-15 with reprex v2.1.0

simonpcouch avatar Jul 15 '24 18:07 simonpcouch