© Thomas Mailund 2017

Thomas Mailund, Beginning Data Science in R, 10.1007/978-1-4842-2671-1_14

14. Profiling and Optimizing

Thomas Mailund

(1)Aarhus, Denmark

In this last chapter, we briefly consider what to do when you find that your code is running too slow, and, in particular, how to figure out why it is running too slow.

Before you start worrying about your code’s performance, though, it is important to consider if it is worth speeding it up. It takes you time to improve performance, and it is only worth it if the improved performance saves you time when this extra programming is included. For an analysis you can run in a day, there is no point in spending one day making it faster, even much faster, because you still end up spending the same ...

Get Beginning Data Science in R: Data Analysis, Visualization, and Modelling for the Data Scientist now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.