Zero-Copy Zen: Boost Performance with Memory View

Kesia Joies (~kesia)


7

Votes

Description:

Are you tired of struggling with memory management in Python? Do you want to take your skills to the next level and achieve maximum performance while minimising memory usage? Look no further, here is Zero-Copy in Python! Zero-copy is a technique in computer programming that allows data to be transferred between different parts of a program without being copied to intermediate buffers. In Python, this technique can be achieved using the memory view object, which provides a view into the memory of other objects. Learn how to efficiently manipulate large datasets and optimise your code with the help of this powerful tool. Whether you're working with sockets, objects or memory profiling, memory view is your key to faster and more efficient Python programming.

In today's data-driven world, efficient memory management is critical for achieving optimal performance in Python. Memory view and byte array provide a powerful combination of tools for managing bytes and memory in Python, enabling zero-copy interactions that can significantly improve performance and reduce memory usage.

Memory view is a built-in Python class that provides a zero-copy interface to the memory of an object, allowing efficient manipulation of large data sets. Memory view objects can be used to share memory between different parts of a program without creating intermediate copies of the data, which can significantly improve the performance of Python code. This feature is particularly useful when working with large arrays, binary data, or network programming using sockets. Memory view can also be used in conjunction with the buffer protocol to work with objects in a zero-copy manner. Overall, memory view is a powerful tool for Python developers looking to optimise their code and improve performance.


Outline of the talk:

  • Understand what is Zero-Copy
    • Compare traditional mechanism with zero-copy of sending file
    • Look into Python example of each mechanism
    • os.sendfile() and it's zero-copy implementation
  • Python's bytes()
    • Basic syntax and examples
  • Python's bytearray()
    • Basic syntax and example
  • Introduction to Memory View
  • Understand buffer protocol
  • Dive into Memory View features
    • Comparison of memoryview() performance
    • Applications & Benefits

Prerequisites:

Python knowledge

Speaker Info:

Kesia Mary Joies is a passionate Python developer, currently working as a Product Engineer in UST. She enjoys leveraging logical thinking to develop software solutions that make people's lives easier. At present, she is focused on developing Strollby - a travel platform that utilises Python microservices with GraphQL backend. She was awarded the Grace Hopper Scholarship for the year 2021, awarded annually to women in Technology. Also, she was recognised recently as the Top 5 Best Women Outgoing Students from India, conducted by IEEE Pune Section and Hope Foundation India. She was a speaker in PyConf Hyderabad 2022, and embarked on her journey as an International speaker at the oldest and longest running volunteer-led Python programming conference, EuroPython Conference 2023.

Speaker Links:

LinkedIn

Section: Developer tools and automation
Type: Talks
Target Audience: Intermediate
Last Updated: