Ruby 3.2.0
ruby-lang.org
ruby-lang.org
If you have any questions, I am more than happy to answer them here. Merry Christmas everyone!
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, …
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!
The key thing is that asdf will keep your ruby + all other languages (node, python, etc.) in sync'd versions.
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.
ML going mainstream via F#, Scala, Rust, even changes in Java and C# to accomodate for ML like features.
Haskell.
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.
- WebAssembly support
- Data immutable object
- pattern matching
- create gems with –ext=rust support
- syntax_suggest
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
https://ankane.org/new-ml-gems https://ankane.org/more-ml-gems
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!
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.
But even if i love Python, the point is still: Make stronger ML support for Ruby.
Cheers to everyone involved, it’s much appreciated.
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.
[1]: https://github.com/matsadler/magnus [2]: https://github.com/oxidize-rb/rb-sys
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.0Ruby 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.
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.
as per speed, ruby 3.2 is 10% faster than 3.1 on shopify infra.
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.
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 :)
The feeling is like speaking to someone with a stutter or walking in a room filled with things to slightly stub your toe onto.
Slow bottlenecking gems? Replace them with new rust native gems as of 3.2