In this video, learn how to use memory_profiler. The author teaches you about the structure and memory layout of other basic Python types, as well as how to reduce memory usage by using more specialized containers.
- [Narrator] Just as we can profile CPU usage,…we can do the same for the other crucial…computing resource: memory.…Now, in Python memory profiling,…it's not always very precise or easy to do,…because the Python interpreter manages memory automatically…and does not always allocate it or release it…in the way that we would expect.…Nevertheless, we can usually get a good sense…of what's happening.…In this video, we'll see how we use…Python's memory profiler,…and will investigate the memory usage…that different Python objects take to store the same data.…
We'll see that our programming choices…can make a huge difference.…After importing all the packages,…I will start with a simple case…of 100,000 floating point numbers.…The natural way to store them is perhaps a…Python list.…We make it as usual with a list comprehension.…Or we can use a number array.…These look similar,…but actually they're very different internally.…In Python, lists are implemented using dynamic arrays.…Effectively, an area of pointers…stored consecutively in memory…
- Designing efficient loops
- Exploiting Python collections
- Writing Pythonic code
- Choosing the best libraries for your tasks
- Downloading webpages with requests
- Parsing HTML with Beautiful Soup
- Manipulating images with Pillow
- Making videos and drawing on maps with matplotlib
- Serving webpages with Jinja2 and Flask
- Working with Python classes
- Taking advantage of functional techniques
- Profiling CPU and memory use
- Exploiting parallelism
Skill Level Intermediate
1. Installation and Setup
Jupyter notebooks3m 19s
2. Writing Python Efficiently
3. Exploiting Python Libraries
4. Advanced: Python Object-Oriented and Functional Programming
5. Introduction to Performance Optimization in Python
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.