re: Creating Ruby native extensions VIEW POST


Cool! I haven't created a native extension yet but this got me researching other alternatives and I found Helix, looks like it lets you write type safe performant Ruby classes in Rust. What's really interesting is that you can use any arbitrary Rust crate in your code.. Gonna have to find a reason to use this πŸ˜„


I haven't used Helix before, but it does seem interesting. I know there are other alternatives for writing native exntesions in Crystal and in Java. I wonder if they differ significantly in performance.


As told there usehelix.com/roadmap#performance-p...

Performance parity with C
In general, Rust is in the same performance ballpark as C for code >written in Rust (sometimes it’s even faster). However, the cost of >crossing from Ruby to Rust is still high (compared to Ruby C >extensions).

That being said, because using native code is so much faster than >Ruby, you can recoup the cost difference pretty quickly. This >problem is more important for chatty APIs, or drop-in replacements >for Ruby APIs that intrinsically require a lot of communication with >Ruby (e.g. to_str).

Code of Conduct Report abuse