Open SV-97 opened 1 year ago
Could you give more details on what setup you needed to make it work? Cargo.toml variables and so on. This might also be a good thing to include in the maturin book,
Yes, it really didn't require any special setup. It's possible to build with maturin develop
and directly profile with py-spy record -o profile.svg --native -- python src/example.py
.
In my particular case I wanted to profile a release build, so I added
[profile.release]
debug = 1
to my cargo.toml
, locally built the extension via maturin develop --release
and then ran the profiling snippet from above. I might look into writing up a small "Profiling" section for the maturin book with that information these coming days.
I've been searching for a way to profile a Python module written in Rust (using pyo3/maturin) for a while but couldn't find anything. I eventually asked on reddit where someone mentioned that I might wanna open an issue here to ask you about future plans for supporting Rust. Since the docs currently state that
I thought I'd give it a shot before opening an issue and it actually worked.
Maybe it would be worth mentioning support for this use-case (more) explicitly in the readme since it's easily missable in the current version.