While testing an application or comparing different algorithms for a given problem, execution time taken by a program is very critical. A good algorithm should execute in minimum amount of time. There are several situations in which we need to monitor the time taken for execution by a program. For example, while learning about sorting algorithms, how do you practically state which algorithm is faster? The answer to this is to calculate the execution time for the same data set. Let's see how to do it.
time is a command that is available with any UNIX-like operating systems. You can prefix
time with the command you want to calculate execution time, for example:
$ time COMMAND
The command will ...