Skip to content

Commit 5f34131

Browse files
see if we can get rid of extra check
1 parent 2ed7b0e commit 5f34131

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

bench/01-declarations.R

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,17 @@ plot_against_base <- function(new_bm,
1717
if (any(commit_is_reference) && Sys.getenv("GITHUB_BASE_REF") != "") {
1818
# if a pull request
1919
reference <- bm[commit_is_reference, "benchmarks"][[1]][[1]]
20-
if ("name" %in% names(reference)) {
20+
# if benchmark exists in base branch
21+
reference <- reference %>%
22+
dplyr::filter(.data$name %in% !!name)
23+
if (nrow(reference) > 0) {
2124
# if benchmark exists in base branch
22-
reference <- reference %>%
23-
dplyr::filter(.data$name %in% !!name)
24-
if (nrow(reference) > 0) {
25-
# if benchmark exists in base branch
26-
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
27-
print(new_bm)
28-
print(new_bm$name)
29-
print(reference)
30-
print(reference$name)
31-
new_bm <- dplyr::bind_rows(reference, new_bm)
32-
stopifnot(nrow(new_bm) == 2)
33-
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
34-
pr_comment <- glue::glue("* {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n")
35-
cat(pr_comment, file = "pr-comment/info.txt", append = TRUE)
36-
}
25+
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
26+
new_bm <- dplyr::bind_rows(reference, new_bm)
27+
stopifnot(nrow(new_bm) == 2)
28+
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
29+
pr_comment <- glue::glue("* {name}: {new_bm$p50[1]} -> {new_bm$p50[2]} ({diff_in_percent}%)\n")
30+
cat(pr_comment, file = "pr-comment/info.txt", append = TRUE)
3731
}
3832
}
3933
new_bm$branch <- factor(new_bm$expression)

0 commit comments

Comments
 (0)