Hmm. Kind of makes you wonder why you're using Ruby at all, which is slow as hell. It appears that once they port all Rails libraries to Rust, it may not take that much effort to create Rust on Rails and get rid of Ruby.
I find a great answer in this area is Crystal. I consider it 'go in ruby clothing'. Like go, Crystal is a typed language and outputs binary executables. They kept the beautiful ruby syntax and made better internals. http://crystal-lang.org/
Helix: Rust and Ruby, Without the Glue
41–50 of 69 posts
Re: Helix: Rust and Ruby, Without the Glue
#42Earlier quoted context omitted.
I was taking the point of "Why is the problem taking so long when it seems like a simple thing to calculate?" which was a little orthonogal from theme of the total post, so I can see why there would be some confusion. The article talked about 30 minutes to run through a "is this set of items in this other set of a bunch of items". While it would probably make sense to do this efficiently in memory the reality is the…
Why hit the network/a central resource when you could just do it locally?
Re: Helix: Rust and Ruby, Without the Glue
#43Re: Helix: Rust and Ruby, Without the Glue
#44Earlier quoted context omitted.
Its a better way of doing things - you can handle things in their native format rather than have to arbitrarily convert to UTF8 (which is an 'encoding' itself). [edit] I remember a talk where Matz was asked this specific question and tried to explain it clearly but seemed confused as to how the questioner could have such a poor grasp of unicode (the difference between monolingual americans and japanese i guess)
String is just a typedef for Vec with some extra convenience functions for working with UTF-8. There's nothing stopping anyone from just using Vec to handle non-UTF-8 data in their native format, nor stopping anyone from writing convenience types like String for other encodings.
Re: Helix: Rust and Ruby, Without the Glue
#45Earlier quoted context omitted.
Ruby's Japanese heritage is probably why it handles encodings like that - I think there were multiple encs it had to deal with at once or something. Also Unicode doesn't completely handle all kanji in that there's some that have an old style not available in Unicode. But maybe that's not relevant.
Unicode now handles all the Kanji in JIS. I wouldn't be surprised if Ruby predated that. It almost certainly predates good library support for all the Kanji in JIS.
Re: Helix: Rust and Ruby, Without the Glue
#46Typos in the article: "slimed down", "you code could"
Is "needle_length = needle.length" actually necessary? I thought repeated calls would be zero cost, but I'm guessing I'm wrong.
Re: Helix: Rust and Ruby, Without the Glue
#47Earlier quoted context omitted.
I was taking the point of "Why is the problem taking so long when it seems like a simple thing to calculate?" which was a little orthonogal from theme of the total post, so I can see why there would be some confusion. The article talked about 30 minutes to run through a "is this set of items in this other set of a bunch of items". While it would probably make sense to do this efficiently in memory the reality is the…
Why hit the network/a central resource when you could just do it locally?
Re: Helix: Rust and Ruby, Without the Glue
#48Hmm. Kind of makes you wonder why you're using Ruby at all, which is slow as hell. It appears that once they port all Rails libraries to Rust, it may not take that much effort to create Rust on Rails and get rid of Ruby.
Ruby is phenomenally easy to write. This post essentially describes a way to make Ruby less slow, which would reduce the incentive to leave the language. Once they port all Rails libraries to Rust, you can still use the extremely-ergonomic Ruby programming language, but it won't be "slow as hell" anymore. And ruby performance is "tolerable in most circumstances" as-is. I certainly agree that it could be awesome to ha…
Re: Helix: Rust and Ruby, Without the Glue
#49Great blog post.. First time I've been sold on Rust, sounds like it's got some great features. Maybe I just had to hear about it from a Ruby dev. :) Typos in the article: "slimed down", "you code could" Is "needle_length = needle.length" actually necessary? I thought repeated calls would be zero cost, but I'm guessing I'm wrong.
Re: Helix: Rust and Ruby, Without the Glue
#50But the Rust version of the blank check doesn't handle any encoding but UTF-8. Helix could wrap up a char iterator for it I suppose, one that calls rb_enc_codepoint_len? And isn't there some common C lib that exposes Unicode functions like is_whitespace? Granted, using a cargo crate is easier than finding and adding a .h, and far easier than getting and linking another lib.
Akira Matsuda actually suggested at RailsConf that maybe Rails handling non-UTF-8 encodings was not necessary, and maybe phasing it out was a good idea. I wasn't present for the talk, just saw his slides.
Checking input, however, is a whole 'nother ballgame.