When to use Rust native extensions

Unlocking accessible and safe performance

Eric Arellano

Multi-Processing Multi-Threading Performance PyPy Use Case

See in schedule

When performance becomes a concern, Python's native extensions empower you to improve the performance of the critical path, while still (mostly) using Python and avoiding a costly rewrite project.

However, native extensions are usually written in C and C++, which are challenging to use safely.

Rust offers a production-ready alternative to C and C++ native extensions. With nearly identical performance, Rust offers memory and concurrency safety, backed by an ergonomic language and a beginner-friendly community (like Python!).

Regardless of your experience with native extensions, C/C++, or Rust, this talk will be an accessible overview of how Rust native extensions have empowered the open source Pants build system to unlock performance, while keeping the expressiveness and flexibility of Python for the majority of Pants developers.

Grounded in Pants's 5 years of experience with the ecosystem—you'll gain an understanding of when it is worthwhile to consider using Python's native extensions with Rust compared to alternatives like PyPy and multiprocessing, along with resources to then learn how to use Rust native extensions.

Type: Talk (45 mins); Python level: Intermediate; Domain level: Intermediate

Eric Arellano


Eric Arellano is a software engineer focused on empowering developers to build at scale through the Pants open-source build system and Toolchain. Before that, he worked on developer productivity at Foursquare and Twitter.

Eric is a volunteer crisis counselor for LGBTQ youth and loves pigs.