Optimizing Programs
This lesson focuses on how to optimize a program.
We'll cover the following
Timing a function
Sometimes it is interesting to know how long a certain computation took, e.g. for comparing and benchmarking calculations. A simple way to do this is to record the start-time before the calculation, and the end-time after the calculation by using the function Now()
from the time
package. The difference between them can then be calculated with Sub()
. In code, this goes like:
Get hands-on with 1400+ tech skills courses.