When writing software, it's frequently important to ensure that some performance constraints are guaranteed. The standard library has most of the tools needed to ensure the timing and resource consumption of the functions we write.
Say we have two functions and we want to know which one is faster:
def function1(): l = [] for i in range(100): l.append(i) return l def function2(): return [i for i in range(100)]