🦀 Calling Rust from Python 🐍 with PyO3 (Twitch live stream)
In this live stream, we played a bit with Rust and Python and managed to integrate the two.
We worked on an Advent do Code problem (year 2022 day 19 - https://adventofcode.com/2022/day/19) which was a quite resource intensive one.
Our first python solution was taking 90 seconds to run.
We rewrote the solution in Rust and exposed it to Python as a library using PyO3 (https://pyo3.rs/).
This made our solution much faster already.
Then we also parallelised our solution for another significant performance improvement
Repository: https://github.com/lmammino/pyo3-experiment
PS: Apologies for the low resolution of the shared coding window. It turns out that doing high-quality coding streams is hard and we still have to learn a few things 😅
Chapters:
00:00:00 Intro
00:02:01 Advent of Code 2022/19 exercise assignment
00:05:26 Review of our current Python solution (slow!)
00:13:50 Looking at the PyO3 README and installing it
00:22:01 Rewriting our Advent of Code solution in Rust using PyO3
00:56:29 Calling our solution from Python
00:58:32 Making our Python solution Multithread
01:05:00 Figuring out how to return complex Python types from Rust
01:10:15 Wrapping up
To see the next episodes live check out our Twitch channel: https://twitch.tv/loige
#rust #python #ffi
Other Videos By Luciano Mammino (loige)
Other Statistics
Rust Statistics For Luciano Mammino (loige)
There are 1,740 views in 26 videos for Rust. There's over 1 day worth of watchable video for Rust published on his channel, or 20.00% of the total watchable video on Luciano Mammino (loige)'s YouTube channel.