December 2017
Beginner to intermediate
470 pages
12h 29m
English
Suppose that we're stuck in our optimization process and don't know what we should change next. What should we do? Well, as we mentioned earlier, we should profile our code to find out our current bottlenecks, and that's what we do here. We use the Rprof() function again to profile our sma_slow_5() implementation.
The results show that the [.data.frame and [ functions are our biggest bottlenecks, and although their names are a bit cryptic, we can guess that they are related to subsetting data frames (which they are). This means that our current most important bottleneck is checking whether we are at an observation that corresponds to symbol we are using, and we are performing such checks at different ...