Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ruby 3.2.0 (ruby-lang.org)
254 points by quechimba on Dec 25, 2022 | hide | past | favorite | 64 comments


We'd already deployed a prerelease version and started serving all Shopify storefront requests with Ruby 3.2 earlier this week. Here is a Twitter thread from me about all the work that into this release from Shopify with respect to performance and stability: https://twitter.com/paracycle/status/1605706226007941122

If you have any questions, I am more than happy to answer them here. Merry Christmas everyone!


Thanks for the detailed write-up. Great to see Ruby getting so much love. Already looking forward to 3.3

Is it a dumb question to ask what additional tooling you use to hop from one version of Ruby to another? There are so many: RVM, Rbenv, …


It is not a dumb question at all. At Shopify we use chruby since it is lightweight and less opinionated. However, devs never really have to use chruby directly, since our in-house `dev` CLI tool can install the Ruby version any project at Shopify specifies and configure `shadowenv` to set the right env variables to use it.


Muchas gracias. Got distracted by Christmas day familial activities and didn't realise you'd replied.

ps: my sis uses Shopify to run her entire online biz and even though I'm the supposedly techie one she's the one that set it up, configured it, and runs it – she wouldn't know what a Ruby is!


Recently have found asdf most flexible, mainly because of plug in systems. https://asdf-vm.com/


New shell instances load much faster when running asdf instead of rbenv/nvm/etc… instead of having multiple processes checking multiple dotfiles for a given environment there is just a process and single file.


Just another +1 to the asdf positivity. I've now used it for years with both Windows (WSL) and on modern OSX.

The key thing is that asdf will keep your ruby + all other languages (node, python, etc.) in sync'd versions.


This. Since I’ve migrated to asdf a lot of related tasks have been easier.


ruby-install and chruby is the dead simple way to go IMO


Nearly, except when using fish shell on non MacOS devices


Do you know if standard latest Rails 7.0.x runs fine on ruby 3.2?


As far as I know, yes, it should. But I haven't tested it so I can't say for sure.


[flagged]


You are too optimistic. The js mind virus is spreading inside fast. The old devs' moving up, the new naive devs' moving in. Web tech is heading towards what tech influencers and companies making money of. You will never see shiny VC backed companies pumping Rust outside of the bubbles.


They clearly haven’t read the HN comments about Ruby


I am not aware of any HN comments that point to Ruby ( or Rails ) being a bottleneck.

Most of them only suggest Ruby ( or specifically Rails ) being more expensive to scale.


Ruby! What a gem.

Seriously, I am super excited about this new release and I will try to deploy it to my prod during Christmas.

Name any other tech that is 27 years old, that you feel excited about.


PostgreSQL is 26 and is still something worth getting excited over and there are even older projects like Erlang, which is 36 years old, where there are still exciting things going on.


People just have to look around.


Java, with all ongoing research, although probably unpopular around here.

ML going mainstream via F#, Scala, Rust, even changes in Java and C# to accomodate for ML like features.

Haskell.


CSS is 26, so almost!


Erlang


Emacs


PHP :)


This is looking really good.

By the way if anyone ends up benchmarking Ruby 3.2 using Docker please be aware that the official Ruby image with a Debian base does not enable YJIT. It may not be included for 6+ months or more specifically not until Debian Bookworm is out[0]. That's because Rust 1.58+ needs to be installed.

[0]: https://github.com/docker-library/ruby/pull/398


- JIT

- WebAssembly support

- Data immutable object

- pattern matching

- create gems with –ext=rust support

- syntax_suggest


It also has performance improvements. They don't look earth-shattering in many cases, but performance improvements are always welcome because they are a win even if you don't use the new functionality.

The improvements in memory allocation are likely to help many cases.

Yjit has matured and is faster, so if you use yjit it's likely to be even faster at a cost of memory (and now uses Rust). Yjit was experimental so many would not use it in production... it is no longer experimental.

This version also implements object shapes, which generally improve performance. For details see: https://www.youtube.com/watch?v=2aVyTtxs0GU


Wish one day Ruby will have strong ML library support. Then i could just use Ruby for all the things.


There are more than you might realize. Some good ones listed here:

https://ankane.org/new-ml-gems https://ankane.org/more-ml-gems


Did you find these here on HN? This is the gem of the day for me

I hadn't seen either of these, and I didn't think I was interested in ML, until I got to the Natural Language Processing section, this is a great article!

Happy Ruby Upgrade Day!


I follow Ankane’s blog. He has some great posts and gems himself.


His name was familiar to me but I wasn't sure where. Turns out I'm using chartkick – definitely hadn't seen the blog before! Bookmarked!


I'm not an ML expert so can't tell how good any of these are but there seem to be enough ML-related stuff for Ruby.

There are a few tensorflow bindings for Ruby. There's torch.rb. There's numo, kinda like numpy. SciRuby lists a bunch of AI-related/numeric gems.

What I'm trying to say is there's no reason to expect Python parity because there's Python and no reason to divert the effort but ML is not quite non-existent in Ruby. Start using it and be the change you want to see in the world.


I don't want to touch Python, and that's the problem. So it's just a wish.

But even if i love Python, the point is still: Make stronger ML support for Ruby.


Maybe you should try Julia? That might still be too much like Python. https://julialang.org/


One useful option is PostresML[1]. If it supports what you need it’s an easy solution for ruby users.

1. https://postgresml.org/


Ruby’s tradition of putting releases out at Christmas is always like a nice little present to play with over the break up to new year.

Cheers to everyone involved, it’s much appreciated.


some bechmarks from 3.1, 3.2 3.2 with jit

https://www.solnic.dev/p/benchmarking-ruby-32-with-yjit


Thank you Ruby core team <3


The web assembly support looks cool.

Years ago I had a requirement for portable ruby on Linux. We'd been using Traveling Ruby which was looking very dated (it's been updated since).

I chose to rewrite in Deno rather than sticking with traveling ruby. But had the official wasi cruby been available we could have stuck with Ruby for that project.


I didn't know Ruby had Rust support, that's seriously awesome. I suppose Rust extensions use the C ABI.


The template generated with bundle gem —-ext=rust uses the Magnus[1] library that provides a high-level friendly Rust wrapper over the Ruby C API, but you can also use rb-sys[2] which is lower level bindings direct to the Ruby C API.

[1]: https://github.com/matsadler/magnus [2]: https://github.com/oxidize-rb/rb-sys


I was writing native extensions about 2 years ago so its been possible for awhile. The rutie crate for rust makes it much easier.


This is what `ruby-build -l` is giving me

   2.7.7
   3.0.5
   3.1.3
   jruby-9.4.0.0
   mruby-3.1.0
   picoruby-3.0.0
   rbx-5.0
   truffleruby-22.3.0
   truffleruby+graalvm-22.3.0


3.2.0 is there if you're using ruby-build as a rbenv plugin and having both as git-based setups.


Ah, I'm using them through homebrew, that would explain it :(


Then I think you're going to have to wait a bit for the homebrew package to be updated.


It landed :)


I would love to hear more about YJIT. Who's using it in production?



Thank you core team!


What’s that speed of this look like vs. Python 3.11? in a world where Python is getting major improvements Ruby is such a direct competitor it too must show similar improvements.


Benchmarks will eventually come out. However, put this into perspective.

Ruby has a JIT. Python doesn't. Until it does, its performance is fundamentally capped by it.

Ruby has two viable alternative runtimes, one that sees a lot of production usage (jruby) and another one which can run the same code as CRuby (truffleruby). Both do not have a GIL. Both have multi-tier JITs, and a huge upside. Most of the ecosystem is known to test compatibility with jruby, and the effort to do the same with truffleruby is well underway.

Compare that with python, where not running Cpython comes with a lot of asterisks, mostly because the ML ecosystem that brought it to massive popularity can only run in Cpython.

Ruby has overall more upside.


Wow! I'm a Ruby on Rails developer and I always thought how Python language is more advanced because it's way more popular programming language than Ruby. Thank you for proving me wrong. :)


I don't know the comparison between them. But your question is also loaded (intentionally or maybe not). Why I say loaded? How you formulated includes the hidden assumption that Python is more advanced or faster. Thus it is not an open question. This may not be your intention, so I am sorry if I am interpreting it in the wrong way.

I got triggered by this because a lot of people put a lot of effort into making this release happen. Don't take away their "wind" by asking veiled questions that hint that other languages are good, especially as this submission is just an announcement and does not make any comparision between Ruby and other languages.

It is ok if you like Python more than Ruby. There is a place for everyone, and I wish people would adopt the mindset of "growing a pie" and not act like every release of any other language is a direct hit to their own choice.

About speed, I would say this:

- if you are creating a project with speed as the primary business value, then yes, don't choose Ruby. Choose C or Crystal

- if your project is a web app, then it does not matter if you choose Python or Ruby

- rarely a project that has speed a core business value dies out because it is slow. So from a business perspective, the criterium of speed is irrelevant.


You can still use Ruby if you have a need for speed. Try JRuby, TruffleRuby, or mruby depending on the application. But be sure that MRI isn't fast enough. MRI will improve faster than any of the others.


to be blunt. I dont care. I dislike python, and i like ruby. I'm sure benchmarks will appear to tell us why ruby is slow, sucks, dead, etc. hell ycombinator is a hate club against ruby.

as per speed, ruby 3.2 is 10% faster than 3.1 on shopify infra.


Same here. I've turned down jobs because it's not worth the pain. I would take one if desperate, or if offered sufficiently more, but, but thankfully few places require much Python for the kind of jobs I'm interested in.

Ruby was fast enough for me to do what I needed with it already in the 1.8.x days. Every improvements since is gravy.

A handful of times over the last 16 years or so I've needed to dip into C extensions for the performance I needed; but in those instances Python wouldn't even remotely cut it either.


Could i know some reasons for you to dislike Python ?


im writing python now as my current feature job

I will list some crap that is mine, and my personal view. not an expert on python, not a programmer designer. I'm 100% convince that alternative exist, or im complete an fool.

- self when writing oop/camelCase vs snake_casse others even better CamelCase_V1_magic_action

- classes with lower cases / strange names

- hundreds of lines of code per functions/ if/else/ etc. open sqlalqhemy and have a look

- if you want async/away you need to colorise your function

- __private__

- len/str, that is basically __len__ __str__

- package management

- map/select/fold/ dont exists. just use [x in y for x in list]

- := strange go var inside of if, that only work there

- if you dont return from a function, then, what the function will return?

a lot of web frameworks, that either copy(rails, sinatra, nextjs)

- a lot of junior developers, with junior code or show to us code

- python is basically a glue lang for c/c++ libraries

- complicated deployment.

- version management also a mess

- cyclic import exception. it sucks. i know im at fault but is tsucks

- people tend to write criple code, because python is easy. I think is a mistake.

- asyncio is hard. but again my view here :) looks easy on js

- I dislike decorators.

- i dislike multiple inheritance :)

- the str format demo.format vs f"{format}" vs whatever else

end of random rants :)


Not OP but I do - because I’ve tried Ruby and python feels like an extremely clunky and inflexible version of it - similar enough to feel quite close and remind me of all the flow and conveniences it doesn’t have.

The feeling is like speaking to someone with a stutter or walking in a room filled with things to slightly stub your toe onto.


ycombinator is a hate club against ruby, go, python, c++, java and every other popular language.


Well the rust support goes a long way.

Slow bottlenecking gems? Replace them with new rust native gems as of 3.2


[flagged]


Ruby is faster than Python in many benchmarks but it obviously varies by domain so make your own benchmarks. Ruby also has JIT which Python does not.


over the years people have done so much using Ruby and the other so called "dead languages", the new kids on the block will never do in a 20 or 30 years ahead.




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

Search: