Rust vs. C for Python Libraries: Evaluating Rust-Compatible Bindings Toolchains
Isabella Basso do Amaral (1), Renato Cordeiro Ferreira (1,2,3,4), Alfredo Goldman (1) ((1) University of S\~ao Paulo, (2) Jheronimus Academy of Data Science, (3) Technical University of Eindhoven, (4) Tilburg University)

TL;DR
This paper compares Rust-compatible bindings toolchains for Python, specifically PyO3, ctypes, and cffi, focusing on performance and ease of use, demonstrating Rust's potential for high-performance Python extensions.
Contribution
It provides a comparative evaluation of Rust's PyO3 toolchain against traditional C-based bindings, highlighting performance benefits and usability considerations.
Findings
PyO3 achieves state-of-the-art performance.
Rust bindings simplify interfacing with Python.
Performance gains over traditional C bindings.
Abstract
The Python programming language is best known for its syntax and scientific libraries, but it is also notorious for its slow interpreter. Optimizing critical sections in Python entails special knowledge of the binary interactions between programming languages, and can be cumbersome to interface manually, with implementers often resorting to convoluted third-party libraries. This comparative study evaluates the performance and ease of use of the PyO3 Python bindings toolchain for Rust against ctypes and cffi. By using Rust tooling developed for Python, we can achieve state-of-the-art performance with no concern for API compatibility.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsComputational Physics and Python Applications · Software Engineering Research · Scientific Computing and Data Management
