This PR should be able to be merged without conflict.
Timings were taken of all major code blocks in server.R by stepping through each tab and each option in the running RMinor app with all possible selections (all regions). All timings were recorded for the code blocks and averaged. The selected code blocks, and the line numbers to which Rminortimings.png corresponds are represented in server_profile.R.
Each of the code blocks implicated in Rminortimings.png were then profiled to better understand why these code blocks took more time than others. These Rprof files are included in profvis/server_prof and can be viewed with profvis::profvis.
The major finding is that the _between functions seem to be consuming the majority of the computation time, and largely due to the calls to lubridate and as.Date functions.
Recommendation: Ensure that the columns currently being coerced to date formats within the call to _between are instead coerced in COHHIO_HMIS prior to app load. That way filtering between becomes a simple filter operation.
Optimize _between functions to remove class coercion calls (I'll look into how we can simplify these _between functions to make them more effecient, more on that later.)
Rminortimings.png:
Plot of the computations that take > 1s to complete.
plot_timings.R:
Code to generate the plot from saved timings
server_profile.R:
Flagged version of server.R with code for saving the tictoc timer log with a button on the About tab.
This PR should be able to be merged without conflict. Timings were taken of all major code blocks in server.R by stepping through each tab and each option in the running RMinor app with all possible selections (all regions). All timings were recorded for the code blocks and averaged. The selected code blocks, and the line numbers to which Rminortimings.png corresponds are represented in server_profile.R.
Each of the code blocks implicated in Rminortimings.png were then profiled to better understand why these code blocks took more time than others. These Rprof files are included in
profvis/server_prof
and can be viewed withprofvis::profvis
.The major finding is that the _between functions seem to be consuming the majority of the computation time, and largely due to the calls to
lubridate
andas.Date
functions. Recommendation: Ensure that the columns currently being coerced to date formats within the call to _between are instead coerced in COHHIO_HMIS prior to app load. That way filtering between becomes a simple filter operation.Rminortimings.png: