[PYTHON] I wanted to worry about execution time and memory usage

Yes, as the title says, I thought I'd care The execution time can be done with almost standard functions, maybe. Execution time method 1 % time test.py The time is output by inputting real 0m0.109s user 0m0.072s sys 0m0.036s

It seems that the time command was not particularly different from my mac or ubuntu.

Execution time method 2 import time start=time.clock()

end=time.clock() print end-start

If you put it from the beginning to the end, the overall speed, if you embed it in a specific class, pinpoint it.

Memory usage method 1 import resource ru = resource.getrusage(resource.RUSAGE_SELF) print ru.ru_maxrss

This is just like the total usage.

Memory usage method 2 from guppy import hpy h = hpy()

print h.heap()

If you put this in the beginning and the end again, it just comes out quite finely and at a glance it is something that is too much information for me.

Recommended Posts

I wanted to worry about execution time and memory usage
I wanted to worry about execution time and memory usage
About _ and __
I want to record the execution time and keep a log.
I just wanted to extract the data of the desired date and time with Django
I tried to illustrate the time and time in C language
I tried to display the time and today's weather w
I tried to let Pepper talk about event information and member information
Hash chain I wanted to avoid (2)
Python (from first time to execution)
I wanted to evolve cGAN to ACGAN
About time series data and overfitting
I tried to organize about MCMC.
Hash chain I wanted to avoid (1)
I want to separate the processing between test time and production environment
I wanted to solve ABC160 with Python
About errors during PyInstaller installation and execution
I wanted to solve ABC159 in Python
I wanted to solve ABC172 with Python
I really wanted to copy with selenium
How to install fabric and basic usage
Implemented DQN in TensorFlow (I wanted to ...)
What I did to save Python memory
I made a tool to estimate the execution time of cron (+ PyPI debut)
I want to make a music player and file music at the same time