Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Imports:
profmem,
rlang (>= 0.2.0),
stats,
tibble,
tibble (>= 3.0.1),
utils
Suggests:
covr,
Expand All @@ -38,4 +38,4 @@ Suggests:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.0.2
RoxygenNote: 7.1.0
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# bench (development version)

* `bench::mark()` and `bench::workout()` no longer support unquote
and splice operators. This fixes inconsistencies in performance
results with functions like `rlang::list2()` (#61).

* `autoplot.bench_mark()` again supports factor levels for `expression`, as intended (#82)

# bench 1.1.1
Expand Down
4 changes: 2 additions & 2 deletions R/mark.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ mark <- function(..., min_time = .5, iterations = NULL, min_iterations = 1,
}

if (is.null(exprs)) {
exprs <- rlang::exprs(...)
exprs <- dots(...)
}

n_exprs <- length(exprs)
Expand Down Expand Up @@ -130,7 +130,7 @@ mark <- function(..., min_time = .5, iterations = NULL, min_iterations = 1,
results$gc[[i]] <- parse_gc(gc_msg)
}

out <- summary(bench_mark(tibble::as_tibble(results, validate = FALSE)),
out <- summary(bench_mark(tibble::as_tibble(results, .name_repair = "minimal")),
filter_gc = filter_gc, relative = relative, time_unit = time_unit)

file <- getOption("bench.file", NULL)
Expand Down
11 changes: 11 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,14 @@ find_package_root <- function(path) {
is_root <- function(path) {
identical(path, dirname(path))
}

dots <- function(...) {
dots <- as.list(substitute(...()))

n <- length(dots)
if (n && rlang::is_missing(dots[[n]])) {
dots <- dots[-n]
}

dots
}
10 changes: 5 additions & 5 deletions R/workout.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#' # The equivalent to the above, reading the code from a file
#' workout_expressions(as.list(parse(system.file("examples/exprs.R", package = "bench"))))
workout <- function(expr, description = NULL) {
expr <- rlang::enquo(expr)
env <- rlang::quo_get_env(expr)
if (rlang::quo_get_expr(expr)[[1]] == "{") {
exprs <- as.list(rlang::quo_get_expr(expr)[-1])
expr <- substitute(expr)
env <- parent.frame()
if (rlang::is_call(expr, "{")) {
exprs <- as.list(expr[-1])
} else {
exprs <- list(rlang::quo_get_expr(expr))
exprs <- list(expr)
}
workout_expressions(exprs, env, description)
}
Expand Down
2 changes: 1 addition & 1 deletion man/autoplot.bench_mark.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/bench-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions man/bench_load_average.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.