Рет қаралды 37,936
Everyone knows that program speed isn't Python's strong point. That's why so many number-crunching data science libraries are written in C.
BUT C can cause headaches. Segfaults are common and memory leaks are something to be feared. What if there was another option? Well, there is. It's Rust. Rust is a blazingly fast, memory-efficient and memory-safe language that's an absolute joy to work with. And I'm going to teach you how to use it to write your Python packages.
Check out the code:
github.com/isaacharrisholt/yo...
Resources:
Maturin: www.maturin.rs/
PyO3: pyo3.rs/
Rustup: rustup.rs/
The Rust Book: doc.rust-lang.org/stable/book/
uuidt: doc.rust-lang.org/stable/book/
Polars: pola.rs
pydantic-core: github.com/pydantic/pydantic-...
__________________________________________
Check out my other socials!
🐦 Twitter ▶ / isaacharrisholt
🖥️ Portfolio ▶ ihh.dev
📝 Blog ▶ isaacharrisholt.com
__________________________________________
Timestamps:
00:00 - Introduction and explanation
00:46 - Prerequisites
00:58 - Script overview
01:19 - Maturin setup
02:09 - Writing the Rust
02:53 - Benchmarking our function
04:08 - Rust limitations
04:43 - Common gotchas
#python #softwareengineer #rust