Speed Up Python With Rust

Publicado em: 17 Julho 2022
no canal de: Nick Space Cowboy
1,322
41

In this video we discuss how we can speed up our Python code using Rust code, Pyo3 (a Rust crate), and a tool called Maturin.

Python programs having slow performance is no secret. There are multiple ways that we can speed up our Python code, but one way to see our Python code perform better is to write a Python module in Rust.
Rust is a beloved, low-level language, that has a reputation for being blazingly fast. Using a Rust crate called Pyo3 and a tool called Maturin we can easily take our Rust code and compile it into a Python module that we can easily use in our Python code. This will allow us to take advantage of Rust's blazingly fast speeds in Python.
I explore these performance improvements by comparing random number generation between Python's standard random library, NumPy, and custom code written in Rust,

Check out Pyo3: https://pyo3.rs/main/module.html

Code used in this video: https://github.com/nkphysics/Explorin...

Table of Contents:
00:00 - Introduction
01:33 - Quick disclaimer
01:58 - General overview or random number generators being used
02:29 - Using Pyo3
03:41 - Using Maturin
04:57 - Further description of the tests
05:42 - Performance with Python Lists
06:27 - Performance with NumPy arrays
07:50 - Performance with Rust Vectors
12:15 - Rust vectors vs optimal use of NumPy
12:51 - Conclusions


Nesta página do site você pode assistir ao vídeo on-line Speed Up Python With Rust duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Nick Space Cowboy 17 Julho 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,322 vezes e gostou 41 espectadores. Boa visualização!