4. Advanced PythonIV. Performance And Optimization29. Timeit and BenchmarksOn this page29. Timeit and Benchmarks timeit measures execution time of small code snippets accurately. Example import timeitprint(timeit.timeit("sum(range(1000))", number=1000)) Wrap-Up Use timeit for quick performance comparisons between code snippets.