logoalt Hacker News

unrealhoangtoday at 1:59 AM1 replyview on HN

a bit tangent question: the communication between Python & Rust, could the pyo3 ser/de of Python objects be better than MsgPack?


Replies

mr_Fatalysttoday at 8:47 AM

Good question. Working with Python objects in PyO3 requires holding the GIL. With MessagePack, Python serializes to bytes, hands them off, and Rust works completely GIL-free from that point. Same on the way back. So the GIL is held only for the brief serde step, not during SQL generation or execution.

show 1 reply