News for hackers. Stuff that matters.
Re:Why Is JRuby Slow? by cutler on Friday May 28, 2021 @11:52PM (#27322900)
If you want fast Ruby it seems Crystal is your only option. Ruby is an interpreted language released in 1996 for scripting. Why are we surprised when attempts to shoe-horn it into something else (Ruby 3.0, JRuby, Truffle Ruby) fall flat?
Re:Why Is JRuby Slow? by jaredcwhite on Saturday May 29, 2021 @12:32AM (#27323043)
Ruby's basically as fast as Node.js. If you look at comparative benchmarks, Roda/Rack/Puma is within spitting distance of Koa, Fastify, etc. Express is actually slower in some benchmarks.

I don't think a lot of people are aware of just how much faster the Ruby ecosystem has gotten in the past few years (especially when you leave Rails out of the equation which is known not to do well in microbenchmarks).

Re:Why Is JRuby Slow? by joelbluminator on Saturday May 29, 2021 @01:04AM (#27323166)
I just heard Matz saying yesterday additional effort will be made to make Ruby run faster specifically on benchmarks. He said while they don't always correlate completely to real world performance, since developers seem to care a lot about benchmarks he wants Ruby devs to feel good about themselves and score well on these.
Re:Why Is JRuby Slow? by bhaak on Saturday May 29, 2021 @02:39AM (#27323484)
> he wants Ruby devs to feel good about themselves

We don't deserve Matz. He's too good to be true. :)

Re:Why Is JRuby Slow? by cutler on Saturday May 29, 2021 @10:08AM (#27325327)
Interested in these benchmarks. Could you specify?
Re:Why Is JRuby Slow? by dragonwriter on Saturday May 29, 2021 @03:54AM (#27323731)
> If you want fast Ruby it seems Crystal is your only option.

Crystal may be fast, but its definitely bot Ruby. Choices for fast not-Ruby are not lacking.

> Why are we surprised when attempts to shoe-horn it into something else (Ruby 3.0, JRuby, Truffle Ruby) fall flat?

Weird that you don’t put Ruby 1.9+ on that list, though that is as much or more a switch from what immediately preceded it with parallelism as an improvement area as 3.0 is (sure, Ractors are a bigger language change, but going from green threads to native threads with a VM lock was a major implementation change.) The difference is that 3.0’s relevant improvements are still experimental and its easier to misrepresent “haven’t yet stabilized and seen wide production use” as “fell flat” than it would be to claim thr same thing about 1.9’s improvements. But its not true in either case.

Re:Why Is JRuby Slow? by zizee on Saturday May 29, 2021 @12:08AM (#27322963)
Could you not make the same argument about JavaScript? JavaScript was pretty slow for many years. Google then put some significant engineering investment into the V8 engine, resulting in a huge increase in JavaScript's performance.
Re:Why Is JRuby Slow? by oefrha on Saturday May 29, 2021 @01:00AM (#27323147)
I think JavaScript performance received very significant investments from the biggest players (Google, Apple, Microsoft, etc.) thanks largely to the fact that you can’t throw more compute at it — JavaScript has to run on crappy user devices developers can’t upgrade. Ruby (or Python) never received anywhere near the JavaScript level of investment in performance. Of course there are fundamental design limitations too.
Re:Why Is JRuby Slow? by kaba0 on Saturday May 29, 2021 @03:40AM (#27323680)
With GraalVM around, niche languages can pretty much take advantage of the significant investment into the JVM. Its whitepaper is truly novel, but the gist of it is that one has to implement an AST-based interpreter for a dynamic language, and then it will make use of state-of-the art JVM GCs, JIT, etc. TruffleRuby is the fastest Ruby implementation around, GraalJS can after warmup match the performance of V8, so it is indeed a very interesting technology.
Re:Why Is JRuby Slow? by cutler on Saturday May 29, 2021 @10:11AM (#27325346)
How is matching V8 performance a big deal given that MRI Rack isn't significantly slower than Node?
Re:Why Is JRuby Slow? by dehrmann on Saturday May 29, 2021 @01:05AM (#27323168)
There's significantly more motivation to run JS faster since JS isn't a choice; if you need an interactive website, it will use JS. Ruby is a choice.
Re:Why Is JRuby Slow? by zizee on Saturday May 29, 2021 @06:07AM (#27324198)
I guess everyone with significant investment in ruby codebases can just "choose" to rewrite everything in another language.

Whilst they are doing their multiyear rewrites, it would be nice if someone could optimise the ruby runtime a bit for them.

Re:Why Is JRuby Slow? by nine_k on Saturday May 29, 2021 @12:57AM (#27323135)
Of course the answer is positive.

But it will take a drastic / complete rewrite of the VM, as it happened to Chrome's and Firefox's JavaScript VMs.

This means many man-years, and a certain break in the continuity, maybe with small but noticeable deviation in the VM's behavior. If we squint just so, we can consider Ruby 3.0 to be such a rewrite.

Crystal is a similar rewrite effort, but a one that isn't trying to stay backwards-compatible.

Re:Why Is JRuby Slow? by zizee on Saturday May 29, 2021 @01:07AM (#27323178)
For those of us with many man years of investment into existing Ruby systems, any further investment into speeding up the language's runtime and general evolution is welcome.
Re:Why Is JRuby Slow? by djur on Saturday May 29, 2021 @12:55AM (#27323123)
Crystal isn't the "only option" for fast Ruby because it's not Ruby. If Crystal is an option, so are a lot of languages.
Re:Why Is JRuby Slow? by pjmlp on Saturday May 29, 2021 @01:10AM (#27323192)
It is the option when syntax familiarity and similar language concepts count.
Re:Why Is JRuby Slow? by jashmatthews on Saturday May 29, 2021 @05:00AM (#27323946)
Crystal is little like Ruby now.
Re:Why Is JRuby Slow? by kaba0 on Saturday May 29, 2021 @03:46AM (#27323703)
Since when did JRuby or Truffle Ruby fall flat? The article is about a given usecase/lib, that as others mentioned uses multiple processes, which doesn’t really favor a JIT runtime.
Re:Why Is JRuby Slow? by canadianfella on Friday May 28, 2021 @11:55PM (#27322914)
> Ruby is an interpreted language released in 1996 for scripting. Why are we surprised when attempts to shoe-horn it into something else (Ruby 3.0, JRuby, Truffle Ruby) fall flat?

Because Lua (1993) and JavaScript (1995) can be very fast.

Re:Why Is JRuby Slow? by nine_k on Saturday May 29, 2021 @12:59AM (#27323145)
To be just, Lua is drastically simpler as a language. A simpler language likely takes less effort to write an efficient JIT for its VM.
Re:Why Is JRuby Slow? by ZeroGravitas on Saturday May 29, 2021 @04:12AM (#27323788)
And javascript's speed seems mostly a result of throwing amazing amounts of smart engineers at it over time, rather than anything inherent in the language itself.
Re:Why Is JRuby Slow? by pjmlp on Saturday May 29, 2021 @01:56PM (#27327000)
How is the state of LuaJIT since Mike's departure?

I don't follow Lua, but I got the feeling it is pretty much stuck on its last version.