swcarpentry / python-second-language

Full-day lesson on Python as a second language.
https://swcarpentry.github.io/python-second-language/
Other
15 stars 15 forks source link

Memory profiling? #17

Open DamienIrving opened 8 years ago

DamienIrving commented 8 years ago

First off, thank you for the great extras lesson on profiling. I'm teaching the regular command line programs lesson today and I'm going to round it off with some (very basic!) examples of how you can interrogate your scripts once you've written them. For debugging I'll simply use pdb.set_trace(), for time profiling I'll definitely be using line_profiler (there are so many time profilers out there but I wasn't aware of one that simple to use!), but I was wondering if there is an equivalently simple tool for memory profiling? In my own work I quite often get memory errors due to the large data arrays I work with, but the many different profiler options out there confuse me. I was thinking you could add a quick note/reference in your lesson to a simple memory profiler?

gvwilson commented 8 years ago

Have a look at code/profiling-and-optimizing.ipynb, contributed by @joeybernard - there's material there on memory profiling that we haven't had time to migrate into the Markdown files.

DamienIrving commented 8 years ago

Perfect! Thanks, @gvwilson