@@ -7,25 +7,30 @@ plot_against_base <- function(new_bm,
7
7
new_bm_label = deparse(substitute(new_bm )),
8
8
file = paste0(" plots/" , new_bm_label , " .pdf" )) {
9
9
new_bm <- bench :: as_bench_mark(new_bm )
10
+ name <- unique(new_bm $ name )
11
+ stopifnot(length(name ) == 1 )
10
12
branches <- gert :: git_branch_list()
11
13
last_commit_base_branch <- branches [branches $ name == Sys.getenv(" GITHUB_BASE_REF" ), " commit" , drop = TRUE ]
12
14
bm <- bench :: cb_read()
13
15
commit_is_reference <- bm $ commit_hash == last_commit_base_branch
14
16
if (any(commit_is_reference ) && Sys.getenv(" GITHUB_BASE_REF" ) != " " ) {
15
17
# if a pull request
16
- reference <- bm [commit_is_reference , " benchmarks" ][[1 ]][[1 ]]
18
+ reference <- bm [commit_is_reference , " benchmarks" ][[1 ]][[1 ]] %> %
19
+ dplyr :: filter(.data $ name %in% !! name )
17
20
reference $ expression <- bench ::: new_bench_expr(Sys.getenv(" GITHUB_BASE_REF" ))
18
21
new_bm $ expression <- bench ::: new_bench_expr(Sys.getenv(" GITHUB_HEAD_REF" ))
19
- new_bm <- rbind(reference , new_bm )
22
+ new_bm <- dplyr :: bind_rows(reference , new_bm )
23
+ new_bm $ branch <- factor (new_bm $ expression )
20
24
}
21
25
plot <- ggplot2 :: ggplot(new_bm ) +
22
26
ggplot2 :: geom_boxplot(ggplot2 :: aes(
23
- x = name , ymin = p0 ,
27
+ x = branch , ymin = p0 ,
24
28
ymax = p100 , lower = p25 ,
25
29
middle = p50 , upper = p75
26
30
),
27
31
stat = " identity"
28
- )
32
+ ) +
33
+ ggplot2 :: ggtitle(name )
29
34
30
35
ggplot2 :: ggsave(file , plot )
31
36
}
0 commit comments