Skip to content

Commit c80a6dd

Browse files
committed
Draft benchmarking code
1 parent 4e3f86e commit c80a6dd

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

bench/bench.R

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
library(tidyverse)
2+
3+
follow_first_parent <- function(data) {
4+
out <- character(nrow(data))
5+
current <- data$commit_hash[[1]]
6+
target <- 0
7+
8+
for (i in seq_len(nrow(data))) {
9+
if (data$commit_hash[[i]] == current) {
10+
target <- target + 1
11+
out[[target]] <- current
12+
if (length(data$parent_hashes[[i]]) == 0) {
13+
break
14+
}
15+
current <- data$parent_hashes[[i]][[1]]
16+
}
17+
}
18+
19+
length(out) <- target
20+
return(out)
21+
}
22+
23+
prune_first_parent <- function(data) {
24+
history <- follow_first_parent(data)
25+
26+
pruned <-
27+
data %>%
28+
filter(commit_hash %in% !!history)
29+
30+
pruned %>%
31+
mutate(id = -row_number()) %>%
32+
arrange(id)
33+
}
34+
35+
data <- bench::cb_read()
36+
37+
pruned <-
38+
data %>%
39+
prune_first_parent()
40+
41+
pruned %>%
42+
select(id, abbrev_commit_hash, benchmarks) %>%
43+
unnest(benchmarks) %>%
44+
select(id, abbrev_commit_hash, os, file, name, time, value = p50) %>%
45+
group_by(os, file, name) %>%
46+
mutate(mean_value = mean(value)) %>%
47+
ungroup() %>%
48+
mutate(norm_value = value / mean_value) %>%
49+
ggplot(aes(x = id, y = norm_value, group = name)) %>% +
50+
geom_line() %>% +
51+
facet_wrap(vars(os, file)) %>% +
52+
scale_y_log10() %>%
53+
plotly::ggplotly()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Document
2+
title:
3+
username:
4+
account: rpubs
5+
server: rpubs.com
6+
hostUrl: rpubs.com
7+
appId: https://api.rpubs.com/api/v1/document/795229/b42d9bbdb0444025b33bfac592544060
8+
bundleId: https://api.rpubs.com/api/v1/document/795229/b42d9bbdb0444025b33bfac592544060
9+
url: http://rpubs.com/publish/claim/795229/c215a9faa0fd4ac5947aeb8b8cfeaa56
10+
when: 1627788578.75794
11+
lastSyncTime: 1627788578.75796

0 commit comments

Comments
 (0)