Skip to content

Commit 94e4be6

Browse files
committed
Added my workflow (Marketplace version) and the two tests I used in the examples
1 parent 9aacf3a commit 94e4be6

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/autocomment.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Autocomment atime-based performance regression analysis on PRs
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
12+
jobs:
13+
comment:
14+
runs-on: ubuntu-latest
15+
container: ghcr.io/iterative/cml:0-dvc2-base1
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
repo_token: ${{ secrets.GITHUB_TOKEN }}
19+
R_KEEP_PKG_SOURCE: yes
20+
steps:
21+
- uses: Anirban166/Autocomment-atime-results@v1.1.6

inst/atime/tests.R

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
pkg.edit.fun = function(old.Package, new.Package, sha, new.pkg.path) {
2+
pkg_find_replace <- function(glob, FIND, REPLACE) {
3+
atime::glob_find_replace(file.path(new.pkg.path, glob), FIND, REPLACE)
4+
}
5+
Package_regex <- gsub(".", "_?", old.Package, fixed = TRUE)
6+
Package_ <- gsub(".", "_", old.Package, fixed = TRUE)
7+
new.Package_ <- paste0(Package_, "_", sha)
8+
pkg_find_replace(
9+
"DESCRIPTION",
10+
paste0("Package:\\s+", old.Package),
11+
paste("Package:", new.Package))
12+
pkg_find_replace(
13+
file.path("src", "Makevars.*in"),
14+
Package_regex,
15+
new.Package_)
16+
pkg_find_replace(
17+
file.path("R", "onLoad.R"),
18+
Package_regex,
19+
new.Package_)
20+
pkg_find_replace(
21+
file.path("R", "onLoad.R"),
22+
sprintf('packageVersion\\("%s"\\)', old.Package),
23+
sprintf('packageVersion\\("%s"\\)', new.Package))
24+
pkg_find_replace(
25+
file.path("src", "init.c"),
26+
paste0("R_init_", Package_regex),
27+
paste0("R_init_", gsub("[.]", "_", new.Package_)))
28+
pkg_find_replace(
29+
"NAMESPACE",
30+
sprintf('useDynLib\\("?%s"?', Package_regex),
31+
paste0('useDynLib(', new.Package_))
32+
}
33+
34+
test.list <- list(
35+
# Performance regression discussed in: https://github.com/Rdatatable/data.table/issues/4311
36+
# Fixed in: https://github.com/Rdatatable/data.table/pull/4440
37+
"Test regression fixed in #4440" = list(
38+
pkg.edit.fun = pkg.edit.fun,
39+
N = 10^seq(3,8),
40+
setup = quote({
41+
set.seed(1L)
42+
dt <- data.table(a = sample(N, N))
43+
setindex(dt, a)
44+
}),
45+
expr = quote(data.table:::shallow(dt)),
46+
"Before" = "9d3b9202fddb980345025a4f6ac451ed26a423be", # This should be changed later. Currently, the source of regression (or the particular commit that led to it) is not clear. In addition, older versions of data.table are having problems when being installed in this manner. (This includes commits from before Mar 20, 2020 or when the issue that discovered or first mentioned the regression was created)
47+
"Regression" = "752012f577f8e268bb6d0084ca39a09fa7fbc1c4", # A commit that is affected by the regression: https://github.com/Rdatatable/data.table/commit/752012f577f8e268bb6d0084ca39a09fa7fbc1c4
48+
"Fixed" = "9d3b9202fddb980345025a4f6ac451ed26a423be"), # The merge commit in #4440, the PR that fixed the regression: https://github.com/Rdatatable/data.table/commit/9d3b9202fddb980345025a4f6ac451ed26a423be
49+
50+
# Test based on: https://github.com/Rdatatable/data.table/issues/5424
51+
# Performance regression introduced from a commit in: https://github.com/Rdatatable/data.table/pull/4491
52+
# Fixed in: https://github.com/Rdatatable/data.table/pull/5463
53+
"Test regression fixed in #5463" = list(
54+
pkg.edit.fun = pkg.edit.fun,
55+
N = 10^seq(3, 8),
56+
expr = quote(data.table:::`[.data.table`(dt_mod, , N := .N, by = g)),
57+
setup = quote({
58+
n <- N/100
59+
set.seed(1L)
60+
dt <- data.table(
61+
g = sample(seq_len(n), N, TRUE),
62+
x = runif(N),
63+
key = "g")
64+
dt_mod <- copy(dt)
65+
}),
66+
"Before" = "be2f72e6f5c90622fe72e1c315ca05769a9dc854", # The commit in PR #4491 that comes before the regression introducting commit: https://github.com/Rdatatable/data.table/pull/4491/commits/be2f72e6f5c90622fe72e1c315ca05769a9dc854
67+
"Regression" = "e793f53466d99f86e70fc2611b708ae8c601a451", # The commit in #4491 that introduced the regression: https://github.com/Rdatatable/data.table/pull/4491/commits/e793f53466d99f86e70fc2611b708ae8c601a451
68+
"Fixed" = "58409197426ced4714af842650b0cc3b9e2cb842") # Last commit in #5463, the PR that fixed the regression: https://github.com/Rdatatable/data.table/pull/5463/commits/58409197426ced4714af842650b0cc3b9e2cb842
69+
)

0 commit comments

Comments
 (0)