Skip to content

Draft benchmarking code #938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions bench/bench.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
library(tidyverse)

follow_first_parent <- function(data) {
out <- character(nrow(data))
current <- data$commit_hash[[1]]
target <- 0

for (i in seq_len(nrow(data))) {
if (data$commit_hash[[i]] == current) {
target <- target + 1
out[[target]] <- current
if (length(data$parent_hashes[[i]]) == 0) {
break
}
current <- data$parent_hashes[[i]][[1]]
}
}

length(out) <- target
return(out)
}

prune_first_parent <- function(data) {
history <- follow_first_parent(data)

pruned <-
data %>%
filter(commit_hash %in% !!history)

pruned %>%
mutate(id = -row_number()) %>%
arrange(id)
}

data <- bench::cb_read()

pruned <-
data %>%
prune_first_parent()

pruned %>%
select(id, abbrev_commit_hash, benchmarks) %>%
unnest(benchmarks) %>%
select(id, abbrev_commit_hash, os, file, name, time, value = p50) %>%
group_by(os, file, name) %>%
mutate(mean_value = mean(value)) %>%
ungroup() %>%
mutate(norm_value = value / mean_value) %>%
ggplot(aes(x = id, y = norm_value, group = name)) %>% +
geom_line() %>% +
facet_wrap(vars(os, file)) %>% +
scale_y_log10() %>%
plotly::ggplotly()
11 changes: 11 additions & 0 deletions bench/rsconnect/documents/bench.R/rpubs.com/rpubs/Document.dcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Document
title:
username:
account: rpubs
server: rpubs.com
hostUrl: rpubs.com
appId: https://api.rpubs.com/api/v1/document/795229/b42d9bbdb0444025b33bfac592544060
bundleId: https://api.rpubs.com/api/v1/document/795229/b42d9bbdb0444025b33bfac592544060
url: http://rpubs.com/publish/claim/795229/c215a9faa0fd4ac5947aeb8b8cfeaa56
when: 1627788578.75794
lastSyncTime: 1627788578.75796