bench
bench copied to clipboard
`scale_*_bench_*()` functions obscure lower values
I've found that the defaults for scale_y_bench_bytes()
and friends often result in axis ticks / grid panels only being applied to the (visually) upper quartile of values. Here's an example from the bench::press()
docs:
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
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
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-08 with reprex v2.1.0