-
Notifications
You must be signed in to change notification settings - Fork 1k
modularize optimization internals #7401
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
base: master
Are you sure you want to change the base?
Changes from all commits
ebd152d
71b21ab
8a9e727
04e5782
a8dde19
67f2874
2876ebe
c445c38
5410e31
dece1c6
5e1789d
62f1c48
c47ec27
1d324d6
6b54c1e
22cf35e
25a7e2e
eb8056c
4544398
d40edb8
5e7efb7
3826927
982343f
996b28c
1e6ad03
9e1297e
f6981d6
9fc4734
6aaea51
c07999a
6914818
6c7e368
08c9524
047f6be
5a7a9a3
b495503
03bcdd8
fe525bf
71b9838
494cfe2
6f42ff5
ac306eb
431dfc2
158136b
0c2f61f
2c7ebaf
371e246
e2694e1
da771d4
af15282
b61f280
d8e34d3
c5fb65a
9f0e5cf
8129198
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -369,11 +369,40 @@ gc_mem = function() { | |||||||||||
| m | ||||||||||||
| # nocov end | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| test = function(num, x, y=TRUE, | ||||||||||||
| error=NULL, warning=NULL, message=NULL, output=NULL, notOutput=NULL, ignore.warning=NULL, | ||||||||||||
| options=NULL, env=NULL, | ||||||||||||
| context=NULL) { | ||||||||||||
| context=NULL, optimize=NULL) { | ||||||||||||
| # if optimization is provided, test across multiple optimization levels | ||||||||||||
| if (!is.null(optimize)) { | ||||||||||||
| if (!is.numeric(optimize) || length(optimize) < 1L || anyNA(optimize) || any(optimize < 0L)) | ||||||||||||
| stopf("optimize must be numeric, length >= 1, non-NA, and >= 0; got: %s", optimize) # nocov | ||||||||||||
| cl = match.call() | ||||||||||||
| if ("datatable.optimize" %in% names(cl$options)) | ||||||||||||
| stopf("Trying to set optimization level through both options= and optimize=") # nocov | ||||||||||||
| cl$optimize = NULL # Remove optimization levels from the recursive call | ||||||||||||
|
|
||||||||||||
| # Check if y was explicitly provided (not just the default) | ||||||||||||
| y_provided = !missing(y) | ||||||||||||
| vector_params = mget(c("error", "warning", "message", "output", "notOutput", "ignore.warning"), environment()) | ||||||||||||
| compare = !y_provided && length(optimize)>1L && !any(lengths(vector_params)) | ||||||||||||
|
Comment on lines
+387
to
+388
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can just drop missing ones up front right? and then simplify below
Suggested change
|
||||||||||||
|
|
||||||||||||
| for (i in seq_along(optimize)) { | ||||||||||||
| cl$num = num + (i - 1L) * 1e-6 | ||||||||||||
| opt_level = list(datatable.optimize = optimize[i]) | ||||||||||||
| cl$options = if (!is.null(options)) c(as.list(options), opt_level) else opt_level | ||||||||||||
| for (param in names(vector_params)) { | ||||||||||||
| val = vector_params[[param]] | ||||||||||||
| if (length(val) > 0L) { | ||||||||||||
| cl[[param]] = val[((i - 1L) %% length(val)) + 1L] # cycle through values if fewer than optimization levels | ||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the idea to allow any type of recycling? Or should we enforce that everything either has length==1 or length==length(optimize)? I guess the main concern is for |
||||||||||||
| } | ||||||||||||
|
Comment on lines
+396
to
+398
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (compare && i == 1L) cl$y = eval(cl$x, parent.frame()) | ||||||||||||
| eval(cl, parent.frame()) # actual test call | ||||||||||||
| } | ||||||||||||
| return(invisible()) | ||||||||||||
| } | ||||||||||||
| if (!is.null(env)) { | ||||||||||||
| old = Sys.getenv(names(env), names=TRUE, unset=NA) | ||||||||||||
| to_unset = !lengths(env) | ||||||||||||
|
|
||||||||||||
Uh oh!
There was an error while loading. Please reload this page.