Zero-Copy
Learn about Zero-Copy in Python.
Often programs have to deal with an enormous amount of data in the form of large arrays of bytes. Handling such a massive amount of data in strings can be very ineffective once you start manipulating it through copying, slicing and modifying.
Memory profiler
Let’s consider a small program that reads a large file of binary data, and partially copies it into another file. To examine our memory usage, we will use memory_profiler, a nice Python package that allows us to see the memory usage of a program line by line.
To run the below code, click on the Run button and use command
python -m memory_profiler memoryview-copy.py
to run thememory_profiler
.
Get hands-on with 1400+ tech skills courses.