Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's been fast for a while now.


To add some nuance to the word "fast."

When we optimize Ruby for performance we debate how to eliminate X thousand heap allocations. When people in Rust optimize for performance, they're talking about how to hint to the compiler that the loop would benefit from SIMD.

Two different communities, two wildly different bars for "fast." Ruby is plenty performant. I had a python developer tell me they were excited for the JIT work in Ruby as they hoped that Python could adopt something similar. For us the one to beat (or come closer to) would be Node.js. We are still slower then them (lots of browser companies spent a LOT of time optimizing javascript JIT), but I feel for the relative size of the communities Ruby is able to punch above its weight. I also feel that we should be celebrating tides that raise all ships. Not everything can (or should be) written in C.

I personally celebrate any language getting faster, especially when the people doing it share as widely and are as good of a communicator as Aaron.


Even a 50% or 2x speed improvment still make it a pretty slow language. It's in the Python range.


What is fast here? Ruby has usually been about 1/150th the speed of C.


If the code JITs well, Ruby performs somewhere between Go and NodeJS. Without the JIT, it's similar to Lua.


Node uses V8 which has a very advanced JIT compiler for the hot code, which does a lot of optimizations for reducing the impact of JS's highly dynamic type system.

The claim that Ruby YJIT beats this is not supported by the data to put it mildly:

https://benchmarksgame-team.pages.debian.net/benchmarksgame/... (scroll down on each submission and you will see it uses YJIT)

(and Go is not a paragon of absolute performance either)


Not at all saying Ruby's compiler is more capable, more that typical Ruby code is easier to optimize by their JIT design than typical JS, largely because Ruby's type system is more sane.

The whitepapers that inspired Ruby's JIT was first tested against a saner subset of JS, and shown to have some promising performance improvement. The better language/JIT compatibility is why the current Ruby JIT is actually showing performance improvements over the previous more traditionally designed JIT attempts.

JS can get insanely fast when it's written like low level code that can take advantage of its much more advanced compiling abilities; like when it's used as a WASM target with machine generated code. But humans tend to not write JS that way.

Agreed about Go as well, it tends to be on the slow side for compiled languages. I called it out not as an example of a fast language, but because it's typical performance is well known and approximately where the upper bound of how fast Ruby can get.


I did a quick search for the white papers and couldn't find them. Would you be kind enough to leave a link or a title? It sounds interesting, I'd like to read more.


I believe this is the paper that started it all (there are a couple of follow up papers): https://arxiv.org/pdf/1411.0352v1

The author was eventually hired to develop YJIT.


If the code JITs well

What does this mean? Any JIT can make a tight loop of math and arrays run well but that doesn't mean a typical program runs well.


For Ruby, it's code where variables and method input/return types can be inferred to remain static, and variable scope/lifetime is finite. From my understanding, much of the performance gain was from removing the need for a lot of type checking and dynamic lookup/dispatch when types were unknown.

So basically, writing code similarly to a statically typed compiled language.


Has it? I thought Ruby was pretty much the benchmark for the slowest language. What is it faster than?


Python. At least, it was a few years ago. Both languages have added JIT compilers since then, so I’m not sure how the most recent versions compare.


I see some people say this but I’ve never seen a benchmark support that if you include performance-focused distributions like pypy.

https://programming-language-benchmarks.vercel.app/amp/pytho...

Is there somewhere with benchmarks that supports the idea that Ruby is faster than Python?


Because unfortunately PyPy is largely ignored by the community , despite their heroic efforts.


I’ve only seen a handful of people use it for local development but I’ve seen plenty of people use it for servers in production. Look like the latest cpython has a JIT built in. It would be cool if it saw the same gains that ruby did.


It is pretty much early days, you are supposed to compile your own CPython to enable it.


Fair point, I was specifically referring to the CPython interpreter. I don’t know if there’s a benchmark that compares PyPy to JIT-compiled Ruby.


Looks the the one at that link does unless there's some newer versioning thing I'm not aware of. The top results seem to be comparing pypy 3.10.14 and ruby/yjit 3.4.1.


Tcl, Vbscript, bash/sh.

Tcl had it’s web moment during the first dot com era within AOLserver.


Not only, you are missing Vignete, and our own Safelayer (yes I know it isn't public).

However exactly because of the experience writing Tcl extensions all the time for performance, since 2003 I no longer use programming languages without JIT/AOT other than for scripting taks, or when the decision is external.

The founders at our startup went on to create OutSystems, with many of the learnings, but using .NET instead, after we were given access to .NET during its "Only for MSFT partners eyes" early state.


Python




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: