Open bbugh opened 5 years ago
@bbugh what did you end up doing? Did you figure out what was the deal with Helix?
@rafbgarcia wow, I cant believe this was already more than a year ago!
After a deep dive with all of the options, we ended up writing C extensions, for the sake of long term maintainability and speed. We know that the C integration will continue to evolve alongside Ruby since it's the official API, but didn't feel that we could confidently say the same of any of the Rust libraries (and at the time, Rutie was the only one still actively being developed). The C extensions are also very portable since anywhere you deploy Ruby also has to be able to build C for things like nokigiri, but using a Rust gem would have required additional infrastructure. Our use case doesn't do any allocation and most of the appealing Rust features (like Option
) wouldn't be applicable. Given all the cons and very few pros over C, the trade offs were not worth it. I'd love for the Ruby community to embrace using Rust for gems, but at the time, I don't think it was production-ready. I am not sure what the state of things are now.
That makes sense, thanks for responding!
Unfortunately, there have been some problems in Helix that have been difficult for us to resolve, as much as we love the API! In our app, Skylight, we continue to use Rust with C-compatible method signatures and a small C glue layer to tie that in to Ruby.
@wagenet is it the case to deprecate the project then?
I say that because I don't know if I would have spent the time I did yesterday looking at the project if I knew that Skylight is not using it anymore because they found some problems.
@rafbgarcia sorry about that, we didn't intend to mislead. We've actually never used it in production ourselves though we did hope to. At this point deprecation in the right thing to do and it's something that's on our radar. My apologies for your wasted effort 😞
@wagenet no problem, it was interesting to learn about it anyways :)
@rafbgarcia it's something I would love to see revisited, it just turned out that we'd basically need to rework things significantly and we haven't had the bandwidth to do so when our current solution does the job for us.
Hi, I'm exploring Rust as an extension for Ruby for a lot of expensive calculations. I made a project that implements a simple financial algorithm in six ways (Ruby, C, Helix, ruru, FFI). They are all implemented with the minimum viable code to allow Ruby to be able to call a Rust function
cash_flow
.The benchmark for Helix was surprising, and I'm curious what is unique about Helix that causes the function calls to return Ruby so slowly in comparison with the other methods.
As you can see from the numbers below, helix's iterations per second when called from Ruby are almost half of ruru, C, and Ruby for a simple function:
However, when running a criterion benchmark for the function within the Rust repository, the performance is superb:
This is a significant difference between the actual function and whatever Helix is doing to connect Ruby to Rust. Obviously with interop there's going to be some performance drop, but as you can see the other methods were approximately comparable.
I want to dig deeper into it because Helix was the best API and usability of all of the methods I tried, but I want to know exactly why the performance is inhibited before we implement critical code with it. Any ideas? Thank you!