Title: | Benchmark the Performance of 'shiny' Applications |
Version: | 0.1.1 |
Description: | Compare performance between different versions of a 'shiny' application based on 'git' references. |
License: | LGPL-3 |
URL: | https://github.com/Appsilon/shiny.benchmark, https://github.com/Appsilon/shiny.benchmark |
BugReports: | https://github.com/Appsilon/shiny.benchmark/issues |
SystemRequirements: | yarn 1.22.17 or higher, Node 12 or higher |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Depends: | R (≥ 3.1.0) |
Suggests: | covr, knitr, lintr, rcmdcheck, rmarkdown, mockr, spelling |
Imports: | dplyr, ggplot2, glue, jsonlite, methods, progress, renv, shinytest2, stringr, testthat, fs |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2023-01-18 12:30:56 UTC; kuba |
Author: | Douglas Azevedo [aut, cre], Appsilon Sp. z o.o. [cph] |
Maintainer: | Douglas Azevedo <opensource+douglas@appsilon.com> |
Repository: | CRAN |
Date/Publication: | 2023-01-20 09:50:02 UTC |
Add the sendTime function to the .js file
Description
Add the sendTime function to the .js file
Usage
add_sendtime2js(js_file, txt_file)
Arguments
js_file |
Path to the .js file to add code |
txt_file |
Path to the file to record the execution times |
Execute performance tests for a list of commits
Description
Execute performance tests for a list of commits
Usage
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
)
Arguments
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 |
Value
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
Description
Run the performance test based on multiple commits using Cypress
Usage
benchmark_cypress(
commit_list,
cypress_dir,
tests_pattern,
app_dir,
port,
use_renv,
renv_prompt,
n_rep,
debug
)
Arguments
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 |
Value
Return a list
with the collected performance times
Run the performance test based on a multiple commits using shinytest2
Description
Run the performance test based on a multiple commits using shinytest2
Usage
benchmark_shinytest2(
commit_list,
shinytest2_dir,
tests_pattern,
app_dir,
use_renv,
renv_prompt,
n_rep,
debug
)
Arguments
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 |
Value
Return a list
with the collected performance times
Check for uncommitted files
Description
Check for uncommitted files
Usage
check_uncommitted_files()
Checkout GitHub branch
Description
checkout and go to a different branch
Usage
checkout(branch, debug)
Arguments
branch |
Commit hash code or branch name |
debug |
Logical. TRUE to display all the system messages on runtime |
Checkout GitHub files
Description
Checkout anything created by the app. It prevents errors when changing branches
Usage
checkout_files(debug)
Arguments
debug |
Logical. TRUE to display all the system messages on runtime |
Create the cypress configuration list
Description
Create the cypress configuration list
Usage
create_cypress_list(plugins_file, port)
Arguments
plugins_file |
The path to the Cypress plugins |
port |
Port to run the app |
Create the JS code to track execution time
Description
Create the JS code to track execution time
Usage
create_cypress_plugins()
Create a temporary directory to store everything needed by Cypress
Description
Create a temporary directory to store everything needed by Cypress
Usage
create_cypress_structure(app_dir, port, debug)
Arguments
app_dir |
The path to the application root |
port |
Port to run the app |
debug |
Logical. TRUE to display all the system messages on runtime |
Create the cypress files under project directory
Description
Create the cypress files under project directory
Usage
create_cypress_tests(project_path, cypress_dir, tests_pattern)
Arguments
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 |
Create the list of needed libraries
Description
Create the list of needed libraries
Usage
create_node_list(tests_path, port)
Arguments
tests_path |
The path to project |
port |
Port to run the app |
Create a progress bar to follow the execution
Description
Create a progress bar to follow the execution
Usage
create_progress_bar(total = 100)
Arguments
total |
Total number of replications |
Create a temporary directory to store everything needed by shinytest2
Description
Create a temporary directory to store everything needed by shinytest2
Usage
create_shinytest2_structure(app_dir)
Arguments
app_dir |
The path to the application root |
Get the commit date in POSIXct format
Description
Get the commit date in POSIXct format
Usage
get_commit_date(branch)
Arguments
branch |
Commit hash code or branch name |
Find the hash code of the current commit
Description
Find the hash code of the current commit
Usage
get_commit_hash()
Load an application and instructions to run shiny.benchmark
Description
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
.
Usage
load_example(path, force = FALSE)
Arguments
path |
A character vector of full path name |
force |
Create example even if directory does not exist or is not empty |
Value
Print on the console instructions to run the example
Examples
load_example(file.path(tempdir(), "example_destination"), force = TRUE)
Move tests to a temporary folder
Description
Move tests to a temporary folder
Usage
move_shinytest2_tests(project_path, shinytest2_dir)
Arguments
project_path |
The path to the project |
shinytest2_dir |
The directory with tests recorded by shinytest2 |
Running the node script "performance_test" is system-dependent
Description
Running the node script "performance_test" is system-dependent
Usage
performance_test_cmd(project_path)
Arguments
project_path |
path to project directory (one level above node) |
Plot for shiny_benchmark class
Description
Plot for shiny_benchmark class
Usage
## S3 method for class 'shiny_benchmark'
plot(x, ...)
Arguments
x |
shiny_benchmark object |
... |
Other parameters |
Value
Return a ggplot
object that compares different git refs
Print for shiny_benchmark class
Description
Print for shiny_benchmark class
Usage
## S3 method for class 'shiny_benchmark'
print(x, ...)
Arguments
x |
shiny_benchmark object |
... |
Other parameters |
Value
Print on the console information about the shiny_benchmark
object
Check and restore renv
Description
Check whether renv is in use in the current branch. Raise error if renv is not in use or apply renv:restore() in the case the package is present
Usage
restore_env(branch, renv_prompt)
Arguments
branch |
Commit hash code or branch name. Useful to create an informative error message |
renv_prompt |
Prompt the user before taking any action? |
Run the performance test based on a single commit using Cypress
Description
Run the performance test based on a single commit using Cypress
Usage
run_cypress_ptest(
commit,
project_path,
cypress_dir,
tests_pattern,
use_renv,
renv_prompt,
n_rep,
debug
)
Arguments
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 |
Value
Return a data.frame
with the collected performance time
Run the performance test based on a single commit using shinytest2
Description
Run the performance test based on a single commit using shinytest2
Usage
run_shinytest2_ptest(
commit,
project_path,
app_dir,
shinytest2_dir,
tests_pattern,
use_renv,
renv_prompt,
n_rep,
debug
)
Arguments
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 |
Value
Return a data.frame
with the collected performance time
An object of 'shiny_benchmark' class
Description
An object of 'shiny_benchmark' class
Slots
call
Function call
time
Time elapsed
performance
List of measurements (one entry for each commit)
Return statistics based on the set of tests replications
Description
Return statistics based on the set of tests replications
Usage
summarise_commit(object)
Arguments
object |
A shiny_benchmark object |
Summary for shiny_benchmark class
Description
Summary for shiny_benchmark class
Usage
## S3 method for class 'shiny_benchmark'
summary(object, ...)
Arguments
object |
shiny_benchmark object |
... |
Other parameters |
Value
Return a data.frame
with performance tests' summary statistics