News for hackers. Stuff that matters.
Re:Improving Interoperability Between Rust and C++ by wongarsu on Monday February 05, 2024 @01:13PM (#39264539)
It's worth mentioning that Rust-Python interoperability is already great, in both directions, thanks to pyo3

https://github.com/PyO3/pyo3

Re:Improving Interoperability Between Rust and C++ by MSFT_Edging on Monday February 05, 2024 @04:06PM (#39267172)
Seconding this. I learned a little rust and really liked its philosophy. I was then working on a small project that needed to avoid the big data science python libraries because they're miserable in terms of portability to air-gapped networks.

We had re-implemented a few mathematical and curve finding functions and even with the newest python they were uncomfortably slow.

PyO3 made it so easy to implement a runtime switchable rust library exposed to python, it was almost unnerving. By writing those handful of functions in rust we got something like a 30x speedup.

Note this was a small project with limited funding for r&d so the level of effort for performance speedup was really nice.

Re:Improving Interoperability Between Rust and C++ by dralley on Monday February 05, 2024 @08:22PM (#39269594)
Why not compile those (python scientific) libraries from source? Why would PyO3 be acceptable while e.g. numpy is not?
Re:Improving Interoperability Between Rust and C++ by MSFT_Edging on Tuesday February 06, 2024 @08:30AM (#39273975)
needing to compile them on the airgapped machine introduces more dependencies. Things also get weird when your airgapped machine is a slight version off from your dev machine. There's a lot of ways around it but we've found for the size of this tool, it was preferable to just write our own handful of math functions over building out a deployment method for extra dependencies.
Re:Improving Interoperability Between Rust and C++ by hintoftime on Monday February 05, 2024 @02:17PM (#39265655)
Yeah, PyO3 is great. I've tried to play around with releasing the GIL from rust in Python 3.12. I would enjoy writing a WSGI/ASGI server with a Celery runtime at some point too. Or contribute to Granian.

https://github.com/emmett-framework/granian

Re:Improving Interoperability Between Rust and C++ by abdullahkhalids on Monday February 05, 2024 @02:45PM (#39266082)
PyO3 is great. But it needs more and better documentation.

I recently did use it for a project, and it was quite a lot of time and pain guessing what would work and what wouldn't.