Skip to content
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

use atime_test/atime_test_list to define performance tests #6102

Merged
merged 5 commits into from
Apr 30, 2024

Conversation

tdhock
Copy link
Member

@tdhock tdhock commented Apr 24, 2024

This PR refactors performance tests to reduce repetition.
new atime_test() lets us avoid using quote() in each setup/expr.
new atime_test_list() lets us avoid repeating the same pkg.edit.fun for each performance test.

Copy link

github-actions bot commented Apr 24, 2024

Comparison Plot

Generated via commit 77917ad

Download link for the artifact containing the test results: ↓ atime-results.zip

Time taken to finish the standard R installation steps: 11 minutes and 50 seconds

Time taken to run atime::atime_pkg on the tests: 3 minutes and 41 seconds

@tdhock tdhock marked this pull request as ready for review April 29, 2024 20:29
Comment on lines -112 to +121
"setDT improved in #5427" = list(
pkg.edit.fun = pkg.edit.fun,
N = 10^seq(1, 7),
setup = quote({
L <- replicate(N, 1, simplify = FALSE)
setDT(L)
}),
expr = quote({
data.table:::setattr(L, "class", NULL)
data.table:::setDT(L)
}),
Slow = "c4a2085e35689a108d67dacb2f8261e4964d7e12", # Parent of the first commit in the PR that fixes the issue (https://github.com/Rdatatable/data.table/commit/7cc4da4c1c8e568f655ab5167922dcdb75953801)
Fast = "1872f473b20fdcddc5c1b35d79fe9229cd9a1d15") # Last commit in the PR that fixes the issue (https://github.com/Rdatatable/data.table/pull/5427/commits)
"setDT improved in #5427" = atime::atime_test(
N = 10^seq(1, 7),
setup = {
L <- replicate(N, 1, simplify = FALSE)
setDT(L)
},
expr = {
data.table:::setattr(L, "class", NULL)
data.table:::setDT(L)
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is re-indenting to the correct level

@tdhock tdhock requested a review from Anirban166 April 29, 2024 20:29
Comment on lines +94 to -105
"memrecycle regression fixed in #5463" = atime::atime_test(
N = 10^seq(3, 8),
setup = quote({
setup = {
n <- N/100
set.seed(2L)
dt <- data.table(
g = sample(seq_len(n), N, TRUE),
x = runif(N),
key = "g")
dt_mod <- copy(dt)
}),
expr = quote(data.table:::`[.data.table`(dt_mod, , N := .N, by = g)),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using atime_test, quote is no longer needed in setup, nor expr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

Comment on lines 77 to 78
"shallow regression fixed in #4440" = list(
pkg.edit.fun = pkg.edit.fun,
pkg.edit.fun = pkg.edit.fun,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using atime_test_list, pkg.edit.fun now can now be defined once here, and then shared among all tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it isn't being detected:

Error in atime::atime_pkg(Sys.getenv("GITHUB_WORKSPACE"), tests.dir = ".ci") : 
  object 'pkg.edit.fun' not found
Calls: <Anonymous> -> do.call -> <Anonymous>
Execution halted

(I tested it on my fork with these changes and got the same too)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be an issue with the scope (defining the function inside the atime::atime_test_list call fixed it for me on my fork)

@MichaelChirico
Copy link
Member

MichaelChirico commented Apr 30, 2024

Looks great, nice improvement!

PS reminder to update the PR description before submitting 👍

#
# @return None (performs in-place file modifications)
# @note This setup is typically unnecessary for most packages but essential for data.table due to its unique configuration.
pkg.edit.fun = function(old.Package, new.Package, sha, new.pkg.path) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved pkg.edit.fun inside test.list, and fixed indentation

@tdhock tdhock merged commit 0b081ae into master Apr 30, 2024
4 of 5 checks passed
@tdhock tdhock deleted the use-atime-test-funs branch April 30, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants