4. Advanced PythonIV. Performance And Optimization28. Profiling with cProfileOn this page28. Profiling with cProfile cProfile is a built-in Python profiler to measure function call times. Example import cProfiledef work(): total = 0 for i in range(10**6): total += i return totalcProfile.run("work()") Wrap-Up Use cProfile to identify bottlenecks in your code.