어떤 부분에서 시간이 오래걸리는지 등을 확인할 때

from cProfile import Profile
from pstats import Stats

profile = Profile()
profile.runcall(my_func)
stats = Stats(profile)
stats.strip_dirs()
stats.sort_stats('cumulative')
stats.print_stats()

위 코드에서 my_func에 원하는 함수를 넣고 돌리면 결과가 나온다.