zhanghaitao1
6/1/2019 - 5:48 AM

memory analyst memoery_profiler

memory analyst memoery_profiler

from memory_profiler import profile


@profile
def test1():
    il=[]
    for i in range(1000):
        il.append(i)
    print(sum(il))

fp=open(r'e:\a\memory_profiler_basic_mean.log','w+')

@profile(precision=3,stream=fp)
def test2(n):
    il=[]
    for i in range(n):
        il.append(i)
    print(sum(il))


if __name__ == '__main__':
    test1()
    test2(1000)