Boosting Python Performance: Harnessing Rust's Power with PyO3

Roshan R Chandar (~Roshan-R)


3

Votes

Description:

Are you interested in leveraging Rust's high-performance and memory efficiency within your Python applications? Integrating Rust can significantly boost the speed and efficiency of Python programs, and PyO3 makes this integration seamless.

This presentation explores PyO3's capabilities, a tool designed for creating native Python modules using Rust. With PyO3, importing Rust code as a Python module is straightforward. It provides effortless type conversion between Python and Rust and incorporates macros that simplify exposing Rust functions to Python.

Additionally, in line with the growing demand for asynchronous programming, PyO3-asyncio emerges as a crucial tool for those dealing with async functions in Python or aiming to create Python bindings for an async Rust library. It simplifies the translation of async functions between Python and Rust. Furthermore, PyO3 facilitates the implementation of parallelism within Rust code, further enhancing performance and efficiency.

  1. Overview of Python & Rust [5 mins]

    • Brief history of Python and Rust
    • Comparison between python and rust
  2. Demonstration of Python and PyO3 [4 mins]

    • Where are the shortcomings of python? An example
    • Making it faster using PyO3
  3. What is PyO3? [6 mins]

    • Syntax
    • Role as a Rust binding for Python
  4. Why PyO3? [5 mins]

    • Comparison with other Python-Rust integration approaches
    • Other libraries
  5. Rust's Performance in Python [5 mins]

    • Benchmarking Python vs. PyO3-Rust performance for CPU-bound tasks
    • Real-world examples
    • Exposing Rust libraries as Python modules
  6. Asynchronous and Parallelism with PyO3 [5 mins]

    • Overview of concurrency in Python
    • Implementing asynchronous programming with PyO3 and Rust
    • Utilizing multi-threading and parallelism with PyO3

Prerequisites:

Basic Python knowledge, a preference for Rust basics and a curious mindset to explore!

Content URLs:

Talk slides: https://docs.google.com/presentation/d/1OWXkJVBkkUBAvSw8jINb61MxunzZ7MzPTxdGlyg9_Oc/edit?usp=sharing

Speaker Info:

Roshan is an enthusiastic Python dev, with a love for exploring the endless possibilities of Python magic! He is a talented presenter with experience at conferences like PyCon Thailand 2023.

He has also achieved success in numerous hackathons and have actively led various Python training sessions. An avid FOSS enthusiast, he has contributed to many open source organisations like the GNOME project and maintains several popular applications.

Currently, Roshan leverages his Python expertise as a backend developer at Strollby, working with Python microservices and GraphQL.

Speaker Links:

Personal website: https://roshan-r.netlify.app

GitHub: https://github.com/Roshan-R

LinkedIn: https://linkedin.com/in/roshan-r-chandar

Gitlab: https://gitlab.gnome.org/Roshan-R

Section: Python in Platform Engineering and Developer Operations
Type: Talk
Target Audience: Intermediate
Last Updated: