Quick exploration of using Rust for extending Python packages.
See test.py.
I felt it was interesting to compare different implementations of taking the maximum value of an array. Some in Python and some through Rust.
Python max(): 0.085s
Python for-loop: 0.161s
Rust max(): 1.361s
Rust 'do nothing': 1.228s
Rust actual max(): 0.133s
Rust pyarrow: 0.359s
Note, calculating the maximum value in Rust is slow because the array data has to be converted and copied.
python -m venv venv
source venv/bin/activate
maturin develop
python test.py
- pyo3
- maturin
- pyarrow integration for Rust: "Pass Arrow objects from and to PyArrow"