Pinned post

Testing out Ruby 3.1 with vs Ruby 3.0.

This shows a sharp decrease of CPU usage for a small Sinatra-based API.

Improvements in response times aren't as visible because the app is mostly IO bound. The app is small, so the memory penalty is light too. I like it.

Thanks Shopify. 👍

Welcome to the new & returning users. Hope we can engage better this time.

Please try to follow up other peers, create your and pin your toot.

Remember this is not a "new twitter" the idea is kind of different. You can check @feditips to get more insights about how the federation works and how to have a better integrated environments.

P.S. there's no edit feature, but you can delete & redraft as I did with this toot.

So, the solution is to not use this Ruby 2 feature anymore. I've taken to using pattern-matching instead.

Yes, it is more verbose in some cases. Not a big deal.

Show thread

I'm porting 2.7 Ruby to Ruby 3, and I'm having trouble iterating an array of hashes with de-structuring keyword args.

Previously, this worked:

a = [{:foo=>1, :bar=>1}, {:foo=>2, :bar=>2}]
a.each { |foo:, bar:| puts "foo: #{foo}, bar: #{bar}" }

With , how do you de-structure each item inline? 🤔

Oh. I managed to miss the RailsConf drama, until I opened the Ruby Weekly newsletter.

I'm sad to say that all the shits of the weeks had already been given at this point. 🤷

Are you WIP-ing son? This is (part of) the commit-logs from a pull-request I was reviewing today.

It made me smile. 😄

On the announcement post for Crystal 1.2: "On a bit of a sour note, we are demoting support for 32-bit x86 architectures, moving it from Tier 1 to Tier 2 (that is, /expected to build/). As a result, we will not be shipping i386 packages this time. The reason is that the specs are failing, likely due to the amount of memory they consume."

A little bit sad to read this. Of course, you could build the compiler, but I read it as a warning against Crystal where memory matters.

The HN comments about the CoC change for Ruby are really fun to read. So many privileged people taking offense as they're required to be nice.

I really want to use the nice dry gems but you can't nest their validators, and there's no way to add custom rules to their schemas (which you can nest 🥲). There are issues and PRs about it since 2019... 😖

I'm pretty sure I could replace the legacy validators with something simpler like Scrivener, because I don't want to reinvent this wheel. 🙃

During a code review, I found code where we were using `Enumerable#find` to choose a value from an array, against data ; building a new Regex on each loop. When your array is sorted `` is orders of magnitude faster:

❯ ruby bm.rb
user system total real
justfind 25.743317 0.048932 25.792249 ( 25.791471)
bsearch 3.192201 0.003215 3.195416 ( 3.195469)
cache 0.285086 0.000304 0.285390 ( 0.285395)

Also, cache things when possible. 😅

I was looking at Babosa (, when I noticed the project is used "a lot" by python devs. 😆

This may not last long, but I find it nice that robots are using Github to auto-generate stuff ; after all Github's opened the box with their own "AI" bot. Still, probably just annoying marketing.

I really like having several "legs" to deploy new features or bug fixes progressively ; but having feature flags to target a few users would also help. 🤔

... then there's the dilemna of "I don't want to be a douche" VS "it's nice to have a clean code base to work on".

Show thread

I'm annoyed when devs add helpers methods to a Ruby class named `AbstractSomething`, but I'm not sure it's actually wrong...

ruby was clearly not the bottle neck here. I guess you need to keep these fork/dump ops to a minimum if you want a fast redis.

Show thread

I recently moved ±28M redis keys between two servers with a ruby script that had to update its source record after migration, and it got slow as fuck while did bg-saves. :/

Show older

A Mastodon instance for Rubyists & friends