Skip to content

Commit b50c272

Browse files
show + if positive
1 parent ec51047 commit b50c272

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bench/01-declarations.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ plot_against_base <- function(new_bm,
1818
# if a pull request
1919
reference <- bm[commit_is_reference, "benchmarks"][[1]][[1]]
2020
# if benchmark exists in base branch
21+
<<<<<<< HEAD
2122
if ("name" %in% names(reference)) {
2223
reference <- reference %>%
2324
dplyr::filter(.data$name %in% !!name)
@@ -30,6 +31,22 @@ plot_against_base <- function(new_bm,
3031
pr_comment <- glue::glue("* {name}: {round(new_bm$p50[1], 3)} -> {round(new_bm$p50[2], 3)} ({diff_in_percent}%)")
3132
cat(pr_comment, file = "pr-comment/info.txt", sep = "\n", append = TRUE)
3233
}
34+
=======
35+
reference <- reference %>%
36+
dplyr::filter(.data$name %in% !!name)
37+
if (nrow(reference) > 0) {
38+
# if benchmark exists in base branch
39+
reference$expression <- bench:::new_bench_expr(Sys.getenv("GITHUB_BASE_REF"))
40+
new_bm <- dplyr::bind_rows(reference, new_bm)
41+
stopifnot(nrow(new_bm) == 2)
42+
diff_in_percent <- round(100 * diff(new_bm$p50) / new_bm$p50[1])
43+
diff_in_percent <- ifelse(diff_in_percent > 0,
44+
paste0("+", diff_in_percent),
45+
diff_in_percent
46+
)
47+
pr_comment <- glue::glue("* {name}: {round(new_bm$p50[1], 3)} -> {round(new_bm$p50[2], 3)} ({diff_in_percent}%)")
48+
cat(pr_comment, file = "pr-comment/info.txt", sep = "\n", append = TRUE)
49+
>>>>>>> show + if positive
3350
}
3451
}
3552
new_bm$branch <- factor(new_bm$expression)

0 commit comments

Comments
 (0)