Live data from Hacker News

Ruby 2.3.0 Released

ruby-lang.org

61–70 of 73 posts

Re: Ruby 2.3.0 Released

#61
Here are two bash functions so that you can compile and execute the bytecode in the terminal:

i.e.

rubyc test.rb

ruby-do test.rbc

in .bashrc:

function rubyc() {

ruby -e "File.open('$1c', 'wb').write(RubyVM::InstructionSequence.compile_file('$1').to_binary)"

}

function ruby-do() {

ruby -e "RubyVM::InstructionSequence.load_from_binary(File.open('$1', 'rb').read).eval"

}

Re: Ruby 2.3.0 Released

#62
post #40

Earlier quoted context omitted.

For me: because nothing else approaches it in terms of linguistic flexibility. I learned Ruby about two years ago, after learning...a dozen-ish languages? Something like that. I don't write web applications in it, because Rails grinds my gears for a whole host of reasons, but for my money it is the can-opener language. If I have a problem, I feel like I can generally explore it faster in Ruby (holla, Pry) and build a…

You should take a look at Crystal!

I have, actually. I really like the idea of it and the project is super impressive (bootstrapping as quickly as they have is legit!), but in practice it doesn't feel right to me. A lot of it is library fit, but a lot of it is inherent to the way that Crystal works. I, personally, find relatively heavy metaprogramming to be super valuable and to make me significantly more productive with my tools. I live on `instance_eval` and `send`, and Crystal's flavor of compile-time macros doesn't do it for me.

I love that it exists, and as it matures I will totally consider it for Big Time Web Application Development (for me that's Kotlin right now). But I don't think it'll ever be quite as "stretchy" as Ruby is, and Ruby's a good all-purpose language, for me, because of that stretch.

Re: Ruby 2.3.0 Released

#63

Earlier quoted context omitted.

(IBMer working on said JIT here) As Chris Seaton points out as well, we're not really open source yet. Working on getting there, but it's going to take time. The important thing now is that we can start talking with the community and making it more likely that when we do get open source, it can happen in a way consumable by the Ruby community.

do you have any status of the project? Or any dates when we can expect?

Unfortunately no dates. We're still working on this, but we really want to do it right, so we're taking the time we need. Sorry!

Re: Ruby 2.3.0 Released

#64
post #13

nobody noticed the bytecode section?

yes. care to elaborate? first thing that came to mind was "APC-style" ( https://secure.php.net/manual/en/intro.apc.php ) caches. but im not super up on deployment, i thought YARV was already supposed to achieve this.

APC exists because PHP reloaded source files each time a script was executed through your webserver. No such parallel exists in Ruby; once source files are loaded in a process, they stay loaded for that process.

In theory it might allow for faster loading of Ruby code (more analogous to Python's .pyc files), but IIRC early experiments (in the early 2.0 days) showed it to be counterproductive in many cases.

Re: Ruby 2.3.0 Released

#65
post #25

Earlier quoted context omitted.

Why? Genuinely curious.

'try' is relatively slow compared to other control logic, as allowing an exception to be thrown involves constructing an exception stack trace. This is slow in all VMs I know. Theoretically you could detect that the trace isn't used and remove it through escape analysis, but this is not easy, or you could do some crazy thing with lazily creating the stack trace, but that's a research project.

I wrote a script to benchmark some of the diff strategies for anyone curious. https://gist.github.com/hopsoft/ae361319c54bbcb4f8e2

Re: Ruby 2.3.0 Released

#67
post #42
post #40

Earlier quoted context omitted.

For me: because nothing else approaches it in terms of linguistic flexibility. I learned Ruby about two years ago, after learning...a dozen-ish languages? Something like that. I don't write web applications in it, because Rails grinds my gears for a whole host of reasons, but for my money it is the can-opener language. If I have a problem, I feel like I can generally explore it faster in Ruby (holla, Pry) and build a…

What about Elixir?

I've used both Elixir and Erlang, but as eropple said about other languages, I feel they solve different problems from Ruby. It's also no way near as mature/popular, so a lot of things you may need to write yourself instead of using an off the shelf gem.

Re: Ruby 2.3.0 Released

#68
post #20

Anyone knows if Ruby has accepted IBM's contribution of JIT for Cruby?? https://news.ycombinator.com/item?id=10715610 And below is the Presentation from Ko1 on compiling Ruby http://rubykaigi.org/2015/presentations/ko1

(IBMer working on said JIT here) As Chris Seaton points out as well, we're not really open source yet. Working on getting there, but it's going to take time. The important thing now is that we can start talking with the community and making it more likely that when we do get open source, it can happen in a way consumable by the Ruby community.

I can tell you that I tried your fork on some toy projects and.. nothing really to report, other than, I'm really scared something this good won't go anywhere.

Fingers crossed to seeing this hit mainline soon.

Re: Ruby 2.3.0 Released

#69
post #25

Interested to see how people start using safe navigation! I personally tend to avoid `try` in Rails in favor of other `nil` handling patterns.

Why? Genuinely curious.

Not him, but I try to use patterns that are portable outside Rails where possible.

Re: Ruby 2.3.0 Released

#70

This is actually a really great release. `&.` removes the really annoying (and slow) `try`. And I think the string literals freezing is going to solve a lot of problems with memory allocations. Check out this PR for Rails that covered a lot of similar performance problems created by too many string allocations. https://github.com/rails/rails/pull/21057/files I wish Rails 5 could go all in on Ruby 2.3.0 and frozen str…

Keep in mind string literal freezing is still off by default. I like that they did it this way, give a chance to see if it actually brings performance improvements in real world scenarios before imposing it on all code.

I've turned it on for all of my projects.

But I think the real benefits will always be in framework code.

Post reply on HN