method1-6 are taken from this article
method7 is added because I believe using generator expression would be faster
to run this experiment, you'll need to install line_profiler
, memory_profiler
and psutil
first, all of which are just one pip install
away.
after installing these profiling tools, we can run stest.py
like this:
kernprof.py -l -v stest.py method1
python -m memory_profiler stest.py method7