Porting to Rust #302
-
Hello! My question is somewhat open. I've enjoyed using Bepu with C# quite a bit, so I'd like to keep using it with Rust. The way I see it, there are two clear options in that regard:
Ross, I recall reading on a forum (I think for Bepu v1) that you considered writing the engine in Rust. Given this, I figured that before diving in, I'd ask whether you have any broad opinions surrounding either option. My thinking is as follows:
I'm happy to port Bepu myself, if only for personal use. Figured that asking your opinion early might save me a lot of potential pain down the road. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
While most of the core data processing bits would port over ~easily, a lot of the bookkeeping would make you want to tear your hair out in rust. Or C#, for that matter. There's a lot of incredibly complicated parallel shared state; a port would realistically have to abandon any pretense of compiler-enforced safety. A lot of it is slated for a revamp, but even then, oof ouch owie. I would not recommend writing a port with an expectation of performance improvements. If they exist at all, they'll be small and primarily relevant in corner cases, like cache-sized simulations. There's already a partial C API and a partial C++ wrapper over in the scratchpad: https://github.com/RossNordby/scratchpad/tree/main/Abomination/AbominationInterop It doesn't yet support constraints and a bunch of other features, but even if you had to add all of them yourself, it would be two to four orders of magnitude less work than porting the whole engine. I intend to get the C API completed eventually, but I'm not sure on the timeline. If certain companies throw a bunch of money at me to do it, I'd be able to do it a lot faster, but I put the chance of that around 20%. |
Beta Was this translation helpful? Give feedback.
While most of the core data processing bits would port over ~easily, a lot of the bookkeeping would make you want to tear your hair out in rust. Or C#, for that matter. There's a lot of incredibly complicated parallel shared state; a port would realistically have to abandon any pretense of compiler-enforced safety. A lot of it is slated for a revamp, but even then, oof ouch owie.
I would not recommend writing a port with an expectation of performance improvements. If they exist at all, they'll be small and primarily relevant in corner cases, like cache-sized simulations.
There's already a partial C API and a partial C++ wrapper over in the scratchpad: https://github.com/RossNordby/scratch…