Jean Boussier's Avatar

Jean Boussier

@byroot.bsky.social

Rails core, Ruby committer, funemployed.

1,547 Followers  |  130 Following  |  204 Posts  |  Joined: 14.06.2023  |  2.1685

Latest posts by byroot.bsky.social on Bluesky

❤️ you're the best

09.08.2025 10:29 — 👍 0    🔁 0    💬 0    📌 0

No need to be sorry. That was my decision and I'm happy about it.

I'm gonna take a break and see what's out there at RailsWorld.

08.08.2025 17:26 — 👍 16    🔁 0    💬 1    📌 0

Bio update: s/Senior Staff Engineer on Shopify's Ruby and Rails infrastructure team/ funemployed/

After almost 12 years, today was my last day at the company. 🫡

08.08.2025 16:41 — 👍 59    🔁 2    💬 13    📌 1

Yeah, I generally agree with that. The devil is in the details though.

08.08.2025 08:24 — 👍 0    🔁 0    💬 0    📌 0

Yup. Common mistake.

08.08.2025 07:23 — 👍 0    🔁 0    💬 0    📌 0

What I mean to say, is the problem is not to much the compiler (erb vs erubi) but the API which is often misused.

Granted, few people need to integrate ERB in a way where performance matter.

07.08.2025 16:29 — 👍 2    🔁 0    💬 1    📌 0

The problem here isn't really Erubi vs vanilla ERB, even though Erubi is a tad better.

The issue is what was being benchmarked included a not so efficient compilation cache inside Tilt.

If you look at the p2 generated code, there's lots of things to rewrite backtraces etc that slow it down.

07.08.2025 16:28 — 👍 2    🔁 0    💬 1    📌 0
Preview
Benchmark against raw Erubi by byroot · Pull Request #1 · digital-fabric/p2 The 2x faster than ERB metric seemed weird to me, given it already has decent code generation, and p2 generated code contains a lot of overhead. Profiling showed that a big part of the difference i...

Rule of thumb: if your benchmark shows you your template engine is significantly faster than ERB, the benchmark likely is using ERB in an imperfect way.

github.com/digital-fabr...

07.08.2025 14:21 — 👍 13    🔁 1    💬 1    📌 0

The redis RTT method is only GVL free if you use `hiredis-client`. The default pure Ruby client has no way to measure the rountrip without being impacted by GVL contention.

06.08.2025 23:33 — 👍 1    🔁 0    💬 1    📌 0

Also Ractors are somewhat getting these sort of capabilities, with `Ractor.select`.

04.08.2025 20:45 — 👍 2    🔁 0    💬 0    📌 0

I see. That seems a bit redundant with Fiber, but `SizedQueue.new(0)` is an interesting idea.

`Queue.select` is too, but not sure how to avoid thundering herd issues for implementations without a GVL 🤔.

Perhaps a `Queue.pop(queues...)` would be more workable.

04.08.2025 20:45 — 👍 1    🔁 0    💬 1    📌 0

Oh wow, that bug still hasn't been fixed 😿

04.08.2025 20:41 — 👍 1    🔁 0    💬 0    📌 0

> We think this is an inaccuracy caused by the thread not having the GVL.

This shouldn't be the case because the event is triggered before trying to acquire the GVL.

But if you have some reproduction, I'm interested.

04.08.2025 18:39 — 👍 1    🔁 0    💬 1    📌 0

I honestly don't know. I always wondered how languages that rely fully on multi-threading do.

Of course they most likely rely on cooperative termination, but not idea what they do in the rare case where it fails.

04.08.2025 18:10 — 👍 1    🔁 0    💬 1    📌 0

And Pitchfork's soft_timeout feature is also followed by a worker shutdown.

04.08.2025 17:42 — 👍 1    🔁 0    💬 0    📌 0

> there is no alternative but to kill the entire runtime? I guess?

Thing is. Once you've used `Thead#kill`, it's a good idea to shutdown, because you have no idea if something was corrupted or not.

I believe `Rack::Timeout` does trigger a full process shutdown after killing a thread.

04.08.2025 17:42 — 👍 1    🔁 0    💬 3    📌 0
class Thread::Queue - Documentation for Ruby 3.4 class Thread::Queue: Queue class implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safel

> Ruby doesn't have any direct analogy to either

Isn't Queue very similar? You can close it to ask for shutdown, etc. docs.ruby-lang.org/en/3.4/Threa...

04.08.2025 17:41 — 👍 1    🔁 0    💬 2    📌 0
Preview
rails/activesupport/lib/active_support/core_ext/object/json.rb at 74092090e7b096904cf0c15db7dfb31970f724ab · rails/rails Ruby on Rails. Contribute to rails/rails development by creating an account on GitHub.

I generally agree. The `#to_json` interface is too encroached to ever be deprecated, but `Object#to_json` could probably be.

I'd need to get rid of the similarly bad behavior in Active Support first, though: github.com/rails/rails/...

04.08.2025 08:52 — 👍 2    🔁 0    💬 0    📌 0
Preview
ruby/test/optparse/test_optparse.rb at 30a20bc166bc37acd7dcb3788686df149c7f428a · ruby/ruby The Ruby Programming Language. Contribute to ruby/ruby development by creating an account on GitHub.

There are also a bunch of interesting uses in the stdlib, e.g.:

github.com/ruby/ruby/bl...

03.08.2025 13:48 — 👍 1    🔁 0    💬 1    📌 0
Preview
o_regexp.rb GitHub Gist: instantly share code, notes, and snippets.

> Are there some dynamic one-time use examples you’re thinking of?

Yes, things like this: gist.github.com/byroot/84b37...

Not saying it's common nor that you aren't better to more explicitly use a memoization pattern. But there is legit uses in the wild.

03.08.2025 13:46 — 👍 2    🔁 0    💬 1    📌 0

I agree that 99.99% of the time /o isn't needed, or not what you want, and the doc definitely should be improved, but I'm not convinced it's worth deprecating it.

03.08.2025 11:33 — 👍 3    🔁 0    💬 0    📌 0

I'm afraid your benchmark doesn't make much sense.

/o only "optimize" if there is interpolation, if you can replace it by a regexp without interpolation, then of course it's simpler and faster, no reason to use /o there.

03.08.2025 11:32 — 👍 2    🔁 0    💬 2    📌 0
What’s wrong with the JSON gem API? As I mentioned at the start of my Optimizing Ruby’s JSON series of posts, performance isn’t why I candidated to be the new gem’s maintainer.

Beyond performance work, I deprecated a bunch of APis in the JSON gem, and added others, so I figured it would be a good occasion to talk about API design: byroot.github.io/ruby/json/20...

02.08.2025 16:19 — 👍 26    🔁 8    💬 2    📌 0
ActiveRecord::ConnectionAdapters::DatabaseStatements

I meant to link to api.rubyonrails.org/classes/Acti...

28.07.2025 17:35 — 👍 1    🔁 0    💬 1    📌 0

nitpick: Consider using one of the `select_*` methods instead of `execute` so Active Record knows it's a read query and can retry it if needed.

28.07.2025 17:00 — 👍 1    🔁 0    💬 2    📌 0

I'm not as familiar with Puma than with Unicorn/Pitchfork, but I suspect these IPC messages are fairly small? Pipes (at least on Linux) are very efficient.

Also I suspect pipes are needed anyway to be able to select/epoll and be notified when new messages are to be read.

26.07.2025 07:41 — 👍 2    🔁 0    💬 1    📌 0
The Advantages Of Flexible Typing

Yes, this one puzzles me as well, considering dynamic typing get dunked on constantly.

> Flexible typing is a feature of SQLite, not a bug.

www.sqlite.org/flextypegood...

I'm totally OK with dynamic typing in my programming language obviously, but not at all for my database.

21.07.2025 08:38 — 👍 6    🔁 0    💬 0    📌 0
NUL Characters In Strings

TIL: www.sqlite.org/nulinstr.html

Hot take 🌶️

The more I deal with SQLite the more I'm astounded it became such a tech darling given its many surprising quirks.

MySQL has been flamed to death for this sort of stuff, and still has poor reputation a decade after most of them have been fixed.

21.07.2025 08:03 — 👍 23    🔁 3    💬 1    📌 0
Conférence de presse officielle, au pupitre est inscrit « réforme des retraites ». Un ministre à l’allure de responsable RH énonce : « Chers concitoyens, vous travaillerez désormais jusqu’à 102 ans… » Réactions indignées dans la salle : « Quoi ?? 102 ans ?! » Un conseiller souffle un mot à l’oreille du ministre-RH. Celui-ci enchaîne dans un sourire narquois : « Ah oui et pour chaque année non-cotisée on vous tranchera un orteil !! » Hurlements outrés du public : « Mais ça va pas ?!! On se laissera pas faire ! » Plus tard, plan large dans le bureau du ministre, le ministre et son conseiller écoutent les infos : « Camouflet pour l’exécutif : la clause orteil est finalement retoquée et la réforme passe sans… » Ils exultent : « Haha, à chaque fois… » [fin]

Conférence de presse officielle, au pupitre est inscrit « réforme des retraites ». Un ministre à l’allure de responsable RH énonce : « Chers concitoyens, vous travaillerez désormais jusqu’à 102 ans… » Réactions indignées dans la salle : « Quoi ?? 102 ans ?! » Un conseiller souffle un mot à l’oreille du ministre-RH. Celui-ci enchaîne dans un sourire narquois : « Ah oui et pour chaque année non-cotisée on vous tranchera un orteil !! » Hurlements outrés du public : « Mais ça va pas ?!! On se laissera pas faire ! » Plus tard, plan large dans le bureau du ministre, le ministre et son conseiller écoutent les infos : « Camouflet pour l’exécutif : la clause orteil est finalement retoquée et la réforme passe sans… » Ils exultent : « Haha, à chaque fois… » [fin]

la clause orteil

17.07.2025 10:13 — 👍 605    🔁 306    💬 4    📌 18

Wow! Not sure if I should tip my hat off or call for help 😅

04.07.2025 18:32 — 👍 2    🔁 0    💬 0    📌 0

@byroot is following 20 prominent accounts