Created
June 18, 2020 15:23
-
-
Save Kumquatum/acd6523d082cea05e272640d9ff9d5b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ********************************************************************* # | |
# Quick script to find which example is the longest to run in a package # | |
# ********************************************************************* # | |
library(magrittr) | |
# Getting function name | |
functions <- list.files("man") %>% | |
strsplit(".Rd") | |
# Timing function exection | |
times <- lapply(functions, function(func){ | |
time_exe <- suppressWarnings({ # fun | |
system.time({ example(func, "GWENA", | |
local = new.env(), | |
character.only = TRUE, | |
ask = FALSE, | |
echo = FALSE)}) | |
}) | |
return(time_exe) | |
}) %>% | |
rlist::list.rbind() %>% | |
set_rownames(unlist(functions)) %>% | |
as.data.frame() %>% | |
.[order(.$user.self, decreasing = TRUE),] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment