Hacker News new | ask | show | jobs
by monadic2 2228 days ago
> I don't see why that would be the case

Well, the extensive use of “method_missing” appears to be staggeringly difficult to optimize short of a tracing jit and it’s also the core idiom of many popular frameworks. Of course it can be faster—if you remove the slow, unique features you can optimize it like any other language.

2 comments

What makes you say that? method_missing is trivial with a tracing JIT and Chris Seaton's PhD covers how to do it for a method JIT.
Which tracing jit would you recommend for production work?

The implication is, of course, that there isn’t a good one. This isn’t ruby the language’s fault, it’s just weird that after like 15 years being the go-to tool for VCs there’s no substantial investment in the core infrastructure.

We just gotta wait for banking software to be written in it, I guess, so there’s a vested interest in it over the long term.

Edit: I’d like to further note that other languages use similar features (string-keyed functions) but they aren’t typically put into high performance code/are seen as a hack around formally definitions (possible exception: common lisp, although I would expect a macro). This is inherently a readability improvement over manually defining the methods you use.

JRuby optimizes method_missing in production right now so there's no need to wait for a tracing JIT.

I hope that Shopify will start to invest more into R&D for CRuby as well now as well as having Chris there working on TruffleRuby.

I'm not sure what you're trying to say with the last part because Ruby works quite differently to Lua or Self here and Self has been "fast" for 30+ years anyway.

> I hope that Shopify will start to invest more into R&D for CRuby as well now as well as having Chris there working on TruffleRuby.

Hi,

I'm the Manager of the Ruby and Rails Foundations team at Shopify.

We are investing a lot on R&D for CRuby as well.

We have 6 people working full time on Ruby implementations, both CRuby and TruffleRuby. Not only Chris Seaton is here, but we have two CRuby Core members as part of the team, Aaron Patterson being one of them.

> JRuby optimizes method_missing in production right now so there's no need to wait for a tracing JIT.

Surely this would reflect in benchmarks? Perhaps there is an even slower aspect of the language manifesting in JRuby....

> I'm not sure what you're trying to say with the last part because Ruby works quite differently to Lua or Self here and Self has been "fast" for 30+ years anyway.

Is this supposed to reflect in Ruby’s favor? Self was built to be performative in spite of its novel features—the slow aspects of the language were never encouraged to take a central role. A better equivalent might be applescript or bash or a language that emphasizes some particular quality of expressiveness.

It does? JRuby 9.2 can be 15% (web), 25% (optcarrot), maybe 3x faster (microbenchmarking iterators) than CRuby depending on what you're doing.

Did you mean messages? They're certainly a central part of Self.

>> Of course it can be faster—if you remove the slow, unique features you can optimize it like any other language.

And at some point you might as well use Crystal if you're going to do that, while keeping a Ruby-like syntax.