Feed on
Posts
Comments

profiling running time in python is straightforward.  what’s tricky is measuring how much memory your program is consuming.  i’ve modified some code i found online to do the trick nicely; just import this PyVM module and insert the following into your program:

import PyVM

PyVM.MemoryUpdate(“memory usage here”)

PyVM.MemoryUpdate(“memory usage there”)

PyVM.MemoryUpdate(“memory usage etc.”)

what will print out in front of each message is: 1) how much additional memory was consumed since the last time MemoryUpdate was called; 2) how much total memory is being used.  note that for now, this module will only function correctly when python is being called on a unix or linux machine.


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS