Title: | Benchmark the Performance of 'shiny' Applications |
---|---|
Description: | Compare performance between different versions of a 'shiny' application based on 'git' references. |
Authors: | Douglas Azevedo [aut, cre], Appsilon Sp. z o.o. [cph] |
Maintainer: | Douglas Azevedo <[email protected]> |
License: | LGPL-3 |
Version: | 0.1.1 |
Built: | 2025-02-12 02:55:46 UTC |
Source: | https://github.com/appsilon/shiny.benchmark |
Execute performance tests for a list of commits
benchmark( commit_list, cypress_dir = NULL, shinytest2_dir = NULL, tests_pattern = NULL, app_dir = getwd(), port = 3333, use_renv = TRUE, renv_prompt = TRUE, n_rep = 1, debug = FALSE )
benchmark( commit_list, cypress_dir = NULL, shinytest2_dir = NULL, tests_pattern = NULL, app_dir = getwd(), port = 3333, use_renv = TRUE, renv_prompt = TRUE, n_rep = 1, debug = FALSE )
commit_list |
A list of commit hash codes, branches' names or anything else you can use with git checkout ... |
cypress_dir |
The directory with tests recorded by Cypress. It can also be a vector of the same size of commit_list |
shinytest2_dir |
The directory with tests recorded by shinytest2 It can also be a vector of the same size of commit_list |
tests_pattern |
Cypress/shinytest2 files pattern. E.g. 'performance' It can also be a vector of the same size of commit_list. If it is NULL, all the content in cypress_dir/shinytest2_dir will be used |
app_dir |
The path to the application root |
port |
Port to run the app |
use_renv |
In case it is set as TRUE, package will try to apply renv::restore() in all branches. Otherwise, the current loaded list of packages will be used in all branches. |
renv_prompt |
Prompt the user before taking any action? |
n_rep |
Number of replications desired |
debug |
Logical. TRUE to display all the system messages on runtime |
Return a shiny_benchmark
object containing the benchmark
call,
elapsed time and a list
with the collected performance times
Run the performance test based on multiple commits using Cypress
benchmark_cypress( commit_list, cypress_dir, tests_pattern, app_dir, port, use_renv, renv_prompt, n_rep, debug )
benchmark_cypress( commit_list, cypress_dir, tests_pattern, app_dir, port, use_renv, renv_prompt, n_rep, debug )
commit_list |
A list of commit hash codes, branches' names or anything else you can use with git checkout ... |
cypress_dir |
The directory with tests recorded by Cypress. It can also be a vector of the same size of commit_list |
tests_pattern |
Cypress/shinytest2 files pattern. E.g. 'shinytest2' It can also be a vector of the same size of commit_list. If it is NULL, all the content in cypress_dir/shinytest2_dir will be used |
app_dir |
The path to the application root |
port |
Port to run the app |
use_renv |
In case it is set as TRUE, package will try to apply renv::restore() in all branches. Otherwise, the current loaded list of packages will be used in all branches. |
renv_prompt |
Prompt the user before taking any action? |
n_rep |
Number of replications desired |
debug |
Logical. TRUE to display all the system messages on runtime |
Return a list
with the collected performance times
Run the performance test based on a multiple commits using shinytest2
benchmark_shinytest2( commit_list, shinytest2_dir, tests_pattern, app_dir, use_renv, renv_prompt, n_rep, debug )
benchmark_shinytest2( commit_list, shinytest2_dir, tests_pattern, app_dir, use_renv, renv_prompt, n_rep, debug )
commit_list |
A list of commit hash codes, branches' names or anything else you can use with git checkout ... |
shinytest2_dir |
The directory with tests recorded by shinytest2 It can also be a vector of the same size of commit_list |
tests_pattern |
shinytest2 files pattern. E.g. 'performance' It can also be a vector of the same size of commit_list. If it is NULL, all the content in cypress_dir/shinytest2_dir will be used |
app_dir |
The path to the application root |
use_renv |
In case it is set as TRUE, package will try to apply renv::restore() in all branches. Otherwise, the current loaded list of packages will be used in all branches. |
renv_prompt |
Prompt the user before taking any action? |
n_rep |
Number of replications desired |
debug |
Logical. TRUE to display all the system messages on runtime |
Return a list
with the collected performance times
This function aims to generate a template to be used
by shiny.benchmark. It will create the necessary structure on path
with
some examples of tests using Cypress and shinytest2. Also, a simple
application will be added to the folder as well as instructions on how
to perform the performance checks. Be aware that a new git repo is need in
the selected path
.
load_example(path, force = FALSE)
load_example(path, force = FALSE)
path |
A character vector of full path name |
force |
Create example even if directory does not exist or is not empty |
Print on the console instructions to run the example
load_example(file.path(tempdir(), "example_destination"), force = TRUE)
load_example(file.path(tempdir(), "example_destination"), force = TRUE)
Plot for shiny_benchmark class
## S3 method for class 'shiny_benchmark' plot(x, ...)
## S3 method for class 'shiny_benchmark' plot(x, ...)
x |
shiny_benchmark object |
... |
Other parameters |
Return a ggplot
object that compares different git refs
Print for shiny_benchmark class
## S3 method for class 'shiny_benchmark' print(x, ...)
## S3 method for class 'shiny_benchmark' print(x, ...)
x |
shiny_benchmark object |
... |
Other parameters |
Print on the console information about the shiny_benchmark
object
Run the performance test based on a single commit using Cypress
run_cypress_ptest( commit, project_path, cypress_dir, tests_pattern, use_renv, renv_prompt, n_rep, debug )
run_cypress_ptest( commit, project_path, cypress_dir, tests_pattern, use_renv, renv_prompt, n_rep, debug )
commit |
A commit hash code or a branch's name |
project_path |
The path to the project with all needed packages installed |
cypress_dir |
The directory with tests recorded by Cypress |
tests_pattern |
Cypress files pattern. E.g. 'performance'. If it is NULL, all the content will be used |
use_renv |
In case it is set as TRUE, package will try to apply renv::restore() in all branches. Otherwise, the current loaded list of packages will be used in all branches. |
renv_prompt |
Prompt the user before taking any action? |
n_rep |
Number of replications desired |
debug |
Logical. TRUE to display all the system messages on runtime |
Return a data.frame
with the collected performance time
Run the performance test based on a single commit using shinytest2
run_shinytest2_ptest( commit, project_path, app_dir, shinytest2_dir, tests_pattern, use_renv, renv_prompt, n_rep, debug )
run_shinytest2_ptest( commit, project_path, app_dir, shinytest2_dir, tests_pattern, use_renv, renv_prompt, n_rep, debug )
commit |
A commit hash code or a branch's name |
project_path |
The path to the project |
app_dir |
The path to the application root |
shinytest2_dir |
The directory with tests recorded by shinytest2 |
tests_pattern |
shinytest2 files pattern. E.g. 'performance'. If it is NULL, all the content will be used |
use_renv |
In case it is set as TRUE, package will try to apply renv::restore() in all branches. Otherwise, the current loaded list of packages will be used in all branches. |
renv_prompt |
Prompt the user before taking any action? |
n_rep |
Number of replications desired |
debug |
Logical. TRUE to display all the system messages on runtime |
Return a data.frame
with the collected performance time
An object of 'shiny_benchmark' class
call
Function call
time
Time elapsed
performance
List of measurements (one entry for each commit)
Summary for shiny_benchmark class
## S3 method for class 'shiny_benchmark' summary(object, ...)
## S3 method for class 'shiny_benchmark' summary(object, ...)
object |
shiny_benchmark object |
... |
Other parameters |
Return a data.frame
with performance tests' summary statistics