python程序运行时间逐行分析

发布时间 2023-11-14 22:17:35作者: 阿奘

比较了cProfile、profile和line_profiler,感觉还是pyinstrument达到了我想要结果。

profiler = Profiler()
profiler.start()
# 添加测试程序 #
profiler.stop()
profiler.print()

运行结果:

参考:https://pythonjishu.com/hwcmuuoueiirgqa/