December 2017
Beginner to intermediate
470 pages
12h 29m
English
If you have identified a function that is called many times in your code and needs to be accelerated, you can write several implementations for it and use the microbenchmark() function from the microbenchmark package to compare them. Its results will also normally be more reliable because, by default, it runs each function 100 times and thus is able to produce statistics on its performance.
To use the microbenchmark() function, you simply wrap it around a piece of code you want to measure. Some handy features are that you can make an assignment, within which it's very handy to measure and use the results in one go; also, you can pass various function calls separated by commas, and it will give ...