-
Notifications
You must be signed in to change notification settings - Fork 27
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
make memory profiling optional and fail-safe. #63
Conversation
close #62. modify memory allocation reporting: NA instead of 0 if not done or failed.
@@ -22,6 +22,8 @@ NULL | |||
#' with [all.equal()], if `FALSE` checking is disabled. If `check` is a | |||
#' function that function will be called with each pair of results to | |||
#' determine consistency. | |||
#' @param memory Profile memory allocation? Defaults to `TRUE`. Can also be a | |||
#' vector to switch memory profiling on or off for each element in `exprs`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to support a vector of values, just a global on or off.
results$result[[i]] <- res$result | ||
} | ||
results$memory[[i]] <- res$memory | ||
if (profile_memory[i] | isTRUE(check)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (profile_memory[i] | isTRUE(check)) { | |
if (profile_memory[[i]] || isTRUE(check)) { |
@@ -231,7 +245,14 @@ summary.bench_mark <- function(object, filter_gc = TRUE, relative = FALSE, time_ | |||
|
|||
object$mem_alloc <- | |||
bench_bytes( | |||
vdapply(object$memory, function(x) if (is.null(x)) NA else sum(x$bytes, na.rm = TRUE))) | |||
vdapply(object$memory, function(x) { | |||
if (is.null(x) || x$trace[1] == "*FAILED*") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would trace == *FAILED*
?
Thanks for working on this! I ended up implementing this somewhat differently, but I adapted your test so made you a co-author on the commit. |
closes #62
Also modifies memory allocation reporting:
allocated bytes are NA instead of 0 if memory profiling was not done or failed.
Created on 2019-10-21 by the reprex package (v0.3.0)
Session info