Professional Documents
Culture Documents
Installation
Usage
The line-by-line memory usage mode is used much in the same way of
the line_profiler: first decorate the function you would like to profile
with @profile and then run the script with a special script (in this case with
specific arguments to the Python interpreter).
@profile
def my_func():
a = [1] * (10 ** 6)
b = [2] * (2 * 10 ** 7)
del b
return a
if __name__ == '__main__':
my_func()
============================================================
4 def my_func():
Decorator
@profile
def my_func():
a = [1] * (10 ** 6)
b = [2] * (2 * 10 ** 7)
del b
return a
@profile(precision=4)
def my_func():
a = [1] * (10 ** 6)
b = [2] * (2 * 10 ** 7)
del b
return a