From the course: Faster Python Code

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

memory_profiler

memory_profiler - Python Tutorial

From the course: Faster Python Code

Start my 1-month free trial

memory_profiler

- [Narrator] If you're running five from two and also need memory profile or need some memory user statistics, you can use memory profiler. Memory profiler is not in the stomach library. And we need to install it before we can use it. You want to compute the sum of differences of values in a list. The file is called sos.py and can find it in the exercise file. Once you have your function, you need to add the profile decorator before the function so memory profile will know to profile this function. At profile, and save the file. And now we switch the terminal and run python dash M memory profiler and our code sos.py. And we got some out. As we can see, line seven is the one that generates most of the memory. We can easily fix this by looking over intercedes and not over values, thus avoiding the location of vials to farming. When we install memory profiler, we also get amplify utility, which is time based profiling.…

Contents