The timeit module in python helps you to measure execution time of your Python code. This module provides you with much precise measurements compared to the time module as it ignores the background processes running on your system, which might have an impact on your code execution.
Another advantage of using the timeit module vs time is that, by default it performs 1 million executions before providing you with an estimate. This allows you to have statistically relevant measurements for your python code.
timeit try to execute the code snippets a lot of time, and give in output an avarege result.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…