标签:code append === 运行 def lis line install incr
安装
首先安装memory_profiler和psutil
pip install memory_profiler
pip install psutil
@profile()
def call():
a = list()
for i in range(10000 * 100):
a .append(i)
运行call后的输出:
Line # Mem usage Increment Line Contents
================================================
283 40.1 MiB 40.1 MiB @profile
284 def call():
285 40.1 MiB 0.0 MiB a = list()
286 44.1 MiB 0.0 MiB for i in range(10000 * 10):
287 44.1 MiB 0.3 MiB a .append(i)
标签:code append === 运行 def lis line install incr
原文地址:https://www.cnblogs.com/bryant24/p/11437479.html