Measuring execution time in R

Sometimes it is crucial to know how long it takes for your algorithm to run. Thus, you can make adjustments and optimize your algorithm to run efficiently simplifying chunks of code that take excessive time to run. In the next lines we will demonstrate two simple ways to measure time to execute.

First method

The run time of a chunk of code can be measured by taking the difference between the time at the start and at the end of the code chunk:

Second method

The second way is equally simple with the first method.

Tags:
,
No Comments

Sorry, the comment form is closed at this time.

× How can we help you?