Skip to content

Commit

Permalink
see if we can get rid of extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed Oct 25, 2020
1 parent 2ed7b0e commit 5f34131
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions bench/01-declarations.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,17 @@ plot_against_base <- function(new_bm,
if (any(commit_is_reference) && Sys.getenv("GITHUB_BASE_REF") != "") {
# if a pull request
reference <- bm[commit_is_reference, "benchmarks"][[1]][[1]]
if ("name" %in% names(reference)) {
# if benchmark exists in base branch
reference <- reference %>%
dplyr::filter(.data$name %in% !!name)
if (nrow(reference) > 0) {
# if benchmark exists in base branch
reference <- reference %>%
dplyr::filter(.data$name %in% !!name)
if (nrow(reference) > 0) {
# if benchmark exists in base branch
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
print(new_bm)
print(new_bm$name)
print(reference)
print(reference$name)
new_bm <- dplyr::bind_rows(reference, new_bm)
stopifnot(nrow(new_bm) == 2)
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
pr_comment <- glue::glue("* {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n")
cat(pr_comment, file = "pr-comment/info.txt", append = TRUE)
}
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
new_bm <- dplyr::bind_rows(reference, new_bm)
stopifnot(nrow(new_bm) == 2)
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
pr_comment <- glue::glue("* {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n")
cat(pr_comment, file = "pr-comment/info.txt", append = TRUE)
}
}
new_bm$branch <- factor(new_bm$expression)
Expand Down

0 comments on commit 5f34131

Please sign in to comment.