Looking back at what we have achieved
As you know, up to now, we have benchmarked our code using a subset of the data that contains only the first 100 observations. However, as we saw at the beginning of the chapter, performance can vary for different implementations, depending on the size of the input. To bring together all our efforts in the chapter, we will create a couple of functions that will help us measure how the execution times for our implementations change as we use more observations from our data.
First, we bring our requirements into R, mainly, the microbenchmark
and ggplot2
packages and the files that contain our implementations.
Next, we create the sma_performance()
function that takes a symbol
, a period
, the original_data
, a list named sizes
whose elements are the number of observations that will be taken from original_data
to test our implementations, a cluster
to avoid the overhead of initializing it within our sma_parallel()
function as we saw in the corresponding section...