After almost a month since the start of the official coding period, the package Rperform is now ready with its initial suite of functions. Building on the proof-of-concept code provide by Toby Dylan Hocking, my mentor, I have written a set of functions for obtaining and plotting time metrics for individual test files over subsequent git versions, and obtain and plot time metrics for files across two given branches. This part had been relatively easy and straight-forward as compared to obtaining the memory metrics, which are work-in-progress at the moment.
The memory metrics posed an issue due to the memory management methodology of R (involving
gc()) which didn’t allow for accurate capture of the memory in use at a particular point of time. However, with Toby’s help and some insights from Hadley, I have been able to obtain the memory metrics for individual test files. The trick was to start a new process through the command-line for each individual commit rather than try to obtain them through the current R process. The code for obtaining memory usage for individual testthat blocks within the files is still being worked out.
The examples for some of the functions from the package are given below.
The following example illustrates the use of the
Rperform::plot_time() function on the git repository
of the package stringr.
> setwd("~/stringr") > library(Rperform) > get_times(test_path = "./tests/testthat/test-extract.r", num_commits = 10)
The following example illustrates the use of
Rperform::mem_compare() on a test file from the package, PeakSegJoint
> setwd("~/PeakSegJoint") > Rperform::mem_compare(test_path = "./tests/testthat/test-likelihood.R", num_commits = 5)
> setwd("~/stringr") > Rperform::plot_btimes(test_path = "./tests/testthat/test-extract.r", branch1 = "stringi", branch2 = "master")
The vertical line divides the results from branch1 commits and branch2 commits, with the former being on the left hand side. In the above example, there existed only one commit in branch1 after the latest common commit.
Next set of targets include completion of memory functionality, writing an initial set of tests and integration with the Travis-CI build system among other things.
The package in its current form can be found on Github (Rperform).