Skip to content
Open
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
12 changes: 9 additions & 3 deletions 23_Measuring_performance.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ f2 <- function(n = 1e5) {
profvis::profvis(f2(), torture = TRUE)
```

Unfortunately, this still takes too long, and we are literally stuck in profiling.
Unfortunately, this still takes too long, and we are literally stuck in profiling. If we set `torture = FALSE` or `torture = 0` the function is too fast for profiling. To workaround this problem, we can use a higher step integer for torture, for example set `torture = 10`. This will still take some time but is already a lot quicker.

Anecdotally, one of the authors once finished the profiling under an older R version. But the output seemed to be not very meaningful.
```{r,eval = FALSE}
f2 <- function(n = 1e5) {
x <- rep(1, n)
rm(list = "x")
}
profvis::profvis(f2(), torture = 10)
```

In conclusion, this question appears to be unanswerable for us, even for Hadley.
The output does not seem meaningful, as we can see that the garbage collector takes a lot of turns. Though, the `torture` flag do allow us to profile a function, which otherwise would be too fast for profiling.

## Microbenchmarking
<!-- 23.3 -->
Expand Down