6 ms·
Ruru: native Ruby extensions written in Rust
- PascalW 10y agoInteresting. Wonder how it compares to Helix [1]. https://github.com/rustbridge/helix https://github.com/rustbridge/helix
- ksec 10y agoOr may be the two should work together?
- fbernier 10y agoI am slightly disappointed by Helix. They pushed an alpha version, made a good and extensive blog post on it and everything it's going to bring to the table, and got us all excited. More than a month later there are obviously some bug reports and pull requests that have been opened. There hasn't been a single answer or acknowledgement from the team behind Helix. Not a single commit either. I get that this is open source software and that they might suddenly not have any time to put on it, but at least an acknowledgement of the situation somewhere or getting some help from contributors would have been appreciated.
- actsasbuffoon 10y agoLooks like the repo hasn't been updated in over a month. This project looks interesting. Anyone know if this is still being developed? In fact, every crate I can find in this category (Helix, ruru, rurust, mrusty, and ruby-sys) is looking a little abandoned. rurust was updated 25 days ago, and that's the most recent.
- GavinMcG 10y agoIt's summer! People are doing things with their lives.
- actsasbuffoon 10y agoWait, people have social lives outside of reading HN? I find this information disturbing.
- craigmcnamara 10y agoHelix was just announced at Rails Conf 2016, so it's definitely not abandoned.
- cookrn 10y agoI think ruby-sys was originally built into ruru, then separated out. Based on comments in PRs, I think the -sys convention is for Rust crates that map 1-to-1 to other languages C apis. Then, packages such as ruru create something more easy to consume and program against.
- steveklabnik 10y agoYes, this is correct. I haven't had more time to build up ruby-sys; and also, wanted to try to integrate it into helix rather than their libcruby-sys.
- diminish 10y agoWhat would it require the whole Ruby to move to Rust from C? What would it bring and would it make sense?
- snuxoll 10y agoA lot of time and probably breaking every native extension. It would probably give us a less buggy VM and GC, but I'm not sure it would be worth the effort to essentially rewrite the entirety of ruby in rust.
- chrisseaton 10y agoIn case you are thinking it would make Ruby significantly faster, I don't see how it would. Ruby is slow due to a lack of caching and dynamic compilation and optimisation, not due to basic interpreter code being slow because it's written in C. I can't see how Rust's parallelism model would help either. Maybe it would prevent some bugs that Ruby currently has? I don't see Ruby as having a problem with bugs though - certainly not that would make it worthwhile to do a translation.
- cm3 10y ago> I can't see how Rust's parallelism model would help either. I'm unaware of a Rust parallelism model. Care to explain?
- azdle 10y agoI'd assume GP is referring to something like http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html http://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.ht... Which is not a parallelism model itself, but is more about how rust's data model lends itself to implementing different kinds of parallelism in a reliable way.
- rubiquity 10y agoProbably a lot of work. It would bring the same things that most rewrites do: Cleaner code in most places and probably some performance due to understanding problems better the second time around. If you were doing the rewrite for performance, it wouldn't be worth it. If you were doing the rewrite for a more modern language to attract more contributors, it might be worth it. I don't think Ruby as a language has had many issues in the space that Rust tends to solve (safety related to memory). Ruby is garbage collected. I don't know what (if any) performance boost the VM would get by being converted to LLVM IR. It's mostly the semantics of Ruby the language that make it hard to make fast. It seems most of the recent efforts to make Ruby faster have been by making the runtime do less allocations.
- haberman 10y agoI wonder how it handles memory management. I just wrote an article about how memory management is handled with Ruby C extensions. It involves some gnarly platform-specific tricks like scanning the C stack looking for "VALUE" pointers (ie. C pointers to Ruby objects). Also Ruby makes you implement a "mark" function to trace references the Ruby interpreter doesn't know about. http://blog.reverberate.org/2016/06/12/native-extensions-memory-management-part1-ruby-mri.html http://blog.reverberate.org/2016/06/12/native-extensions-mem... I wonder if this works the same for Rust.
- ksec 10y agoWhy is it many of the Ruby Communities have decided to argument Ruby with Rust, rather then something much more similar to Ruby like Swift or Crystal?
- kibwen 10y agoLikely because people in the Ruby community tend to favor solutions that allow them to continue writing Ruby. In the context of the OP, Rust is being used only to augment Ruby, to complement it, not to outright replace it. Adopting Swift or Crystal would involve rewriting much more code from Ruby into the new language. Look at it this way: for these programmers, the choice isn't between Rust and Crystal, it's between Rust and C. And for people who've never written systems code before, Rust is enormously friendlier.
- ksec 10y agoSorry I wasn't being clear in the first post. I meant argument Ruby with Rust. Yes the Choice is pretty much something to replace / use instead of C. Which Swift as well as Crystal can be used in here too.
- kibwen 10y ago> Swift as well as Crystal can be used in here too Can you elaborate? I don't know of any way to compile Swift or Crystal code into a library that exposes a C-compatible ABI, and I can find no documentation as such.
- 15155 10y agoCross-platform support, lack of GC, direct C ABI interop.
- actsasbuffoon 10y agoThere is a proof of concept that attempts to allow Crystal extensions for Ruby: https://github.com/manastech/crystal_ruby https://github.com/manastech/crystal_ruby That said, it's just a proof of concept. It'll probably be a while before it becomes robust enough for regular users.