In this chapter, we saw the most important reasons behind slow R code: programming without understanding object immutability, the nature of interpreted dynamic typings, memory-bound processes, and single-threaded processes. We learned that the first one can be reduced by properly using R, the second one can be reduced by delegating to statistically typed languages such as Fortran or C++, the third one can be reduced using more powerful computers (specifically with more RAM), and, finally, the fourth one can be reduced using parallelization.
We also mentioned some variables that we may want to take into account when deciding whether or not to optimize our implementations, how small a difference in implementation may result in big performance enhancements, and how the performance gains from these enhancements can become larger as the size of the inputs increases. Finally...