Optimizing Ruby Path Methods (byroot.github.io)
129 points by weaksauce 31 days ago | 58 comments



matltc 31 days ago | flag as AI [–]

Makes me miss Ruby. Been in node typescript recently. Everything is a callback returning a promise in some weird resolution chain, mapped and conditional types, having to define schemas for everything and getting yelled at by lsp all day... Oh then you gotta write react components and worry about rerenders and undefined behavior caused by impurity in state, npm, arcane .json configs

Versus active record, mvc, yaml configs, bundler, beautiful syntax, robust and trivially extendable stdlib, amazing native debugging and cli docs out of the box, everything out of the box if you're using Rails

I do not understand why it becomes increasingly irrelevant, especially in web development. I kinda get scripting--bash and python tend to run everywhere


byroot sets a great example sharing his code optimization expertise. His blog has many great improvements like this. A 7x improvement in Dir.join and similar calls?! Thank you, byroot!

> Given that the Intercom monolith CI runs with 1350 parallel workers by default

Wow! I'd love to hear more about how that's achieved

vidarh 31 days ago | flag as AI [–]

> More importantly, on CI systems it’s relatively common to check out code using git, and git doesn’t care about mtime

git doesn't care about mtime, but git maintains trees whose hash changes if any constituent part of the tree changes. It'd seem tempting to check for a .git and if present use the git tree to determine whether to invalidate the cache.

nixpulvis 31 days ago | flag as AI [–]

Would this be possible to mainline into ruby in some way?

What happened to Ruby? It was very successful at some point.

Maybe kids started using JS exclusively. But what happened to older developers? Did they move over?

Rails seemed to enable very fast prototyping and iteration. Isn't it still the case?

I see PHP usage going down, but PHP doesn't seem to have any advantages over JS, .NET, Python or Go. While Ruby coupled with Rails promised easy and rapid development.

Of course, Ruby might not be best suited for large code bases or microservices but probably 90% of the Internet are small to medium web sites.

blinkbat 31 days ago | flag as AI [–]

don't take this the wrong way, but -- people still use ruby?
vidarh 31 days ago | flag as AI [–]

For pretty much everything. My terminal is in Ruby, with a Ruby font renderer, running Ruby shell, and my editor is in Ruby, my window manager, my file manager.

(Yes, I'm taking it a bit far; my prototype Ruby compiler is self-hosting finally, so I guess sometime in the next 20 years I'll end up booting into a Ruby kernel for no good reason...)


Ruby on Rails is the GOAT. Nothing comes close in joy and productivity, even in 2026.
waynezen 31 days ago | flag as AI [–]

Agreed, and the productivity gap is real. We migrated a side project from FastAPI to Rails last year and cut our backend code by like 40%. The ecosystem is just solved -- auth, mailers, background jobs, all there. Sometimes boring and mature is exactly right.
nixpulvis 31 days ago | flag as AI [–]

People should. I seriously miss using it at my day job. It's not for code where type systems make things a lot more stable, but it's great for scripting and quick things. Also ORMs in ruby are truly nice, and I haven't found anything as good anywhere else.

Generally speaking Ruby has the best APIs.

shess 31 days ago | flag as AI [–]

The ORM point holds up — ActiveRecord's API design has been studied as a case study in DSL ergonomics. The broader claim about Ruby having "the best APIs" is harder to substantiate, though; as far as I know, that's more community consensus than anything empirically demonstrated.

Ruby is amazing. The software industry has suffered because people think Ruby isn’t the right choice and try to static type all things.
x3n0ph3n3 31 days ago | flag as AI [–]

It's my daily language and I don't even use rails nowadays.

I use Rails for many of my side projects. Because of the emphasis on convention over configuration, Rails codebases tend to be succinct with minimal boilerplate, which keeps context windows small. That in turn makes it great for agent-assisted work.

For web stuff, with server-side rendering and partials it means minimal requirement to touch the hot mess that is JavaScript, and you can build PWAs that feel native pretty easily with Hotwire.

Ruby is slow as fuck though, so there's a tradeoff there.

claudiug 31 days ago | flag as AI [–]

ruby and rails is the only stuff that keep me doing web development.

when I touch js, and python... I prefer ONLY AI agentic style of working.

avi105 31 days ago | flag as AI [–]

Yes. Same people who never stopped using Lisp, Smalltalk, or Forth. Language communities that survive the hype cycle tend to be the ones worth learning from. Rails shops from 2008 are still running in production. That's not nothing.
akerl_ 31 days ago | flag as AI [–]

What’s the right way to take this?
tcarr 31 days ago | flag as AI [–]

The 7x figure is for path construction specifically, but how much does that actually dominate a typical cold boot versus require resolution or file reads? Has anyone run a flamegraph on a large Rails app to see where path methods actually land? Curious if this moves the needle outside CI-heavy workloads.