Xavier Noria
banner
fxn.bsky.social
Xavier Noria
@fxn.bsky.social
Everlasting student · Rails Core · Zeitwerk · Freelance · Life lover
Awesome, yours is battle-tested.
February 2, 2026 at 7:16 PM
And that cache saves a ton of time in gem dependencies, which generally do not change, they are just sitting there.

Where do you store the cache?
February 2, 2026 at 12:57 PM
Aha, if the stat + cache says no entries were added/removed, you save the syscall for its listing right?

Yeah, so without the cache I'd do roughly twice as many syscalls for directories in the worst case.

That cache is a cool trick.
February 2, 2026 at 12:54 PM
You need to stat the dir to get the mtime right?

I believe forbidding extensions in directories that represent namespaces would have a comparable amount of syscalls in practice without the extra complexity.
February 2, 2026 at 12:01 PM
Ahhh, persisted would work yes.
February 2, 2026 at 11:55 AM
Let me clarify just in case that booting the app does not mean launching a web server.

It means running the boot process that allow you to use the stuff. As in the runner or console commands, things are ready for you.
February 2, 2026 at 11:54 AM
Agree, not throwing the towel, we'll persevere :).
February 2, 2026 at 11:52 AM
Oh, tests boot the app.

That is why bin/rails boot is the baseline.
February 2, 2026 at 11:51 AM
Oh yes, regular gems or small/medium apps won't notice.

It's the big ones where things amplify, and where you do not want to introduce perf regressions.
February 2, 2026 at 11:28 AM
You can also technically collapse a directory with a .rb extension.
February 2, 2026 at 10:44 AM
Camelizing a directory with a .rb extension does not give you a constant identifier by default, but custom inflectors can provide one. I implemented the most generic logic.
February 2, 2026 at 10:43 AM
Hmmm, that could help reloads, but perhaps not a lot boot time/eager loading.

Zeitwerk discards anything that does not have a .rb extension. I could document directories with .rb extension are no supported.

With that, I could save a good deal of syscalls.
February 2, 2026 at 10:42 AM
It is more dirs, plus a syscall per dir entry to know its type.

@byroot.bsky.social is working on an API to fetch the type with the listing in one syscall. That would mitigate it I suppose.
February 2, 2026 at 9:44 AM
time bin/rails boot

The only difference is that the loader scans more dirs on setup (those without a corresponding .rb file, transitive).
February 2, 2026 at 9:40 AM
The extra work does not involve loading files, it is just system calls mostly, this alternative approach scans more of the project tree on setup.
February 1, 2026 at 7:51 PM
Eager loading would be the same, we are just doing more work upfront.

But boot time in dev/test is something I don't want to mess with.
February 1, 2026 at 7:15 PM
That bike!
January 30, 2026 at 10:35 PM
*autoloads on boot
January 29, 2026 at 11:16 AM
For example, if you have a performance spec that fails if a Rails app autoloads more than a given allow list, it will not pass.

Performance is OK, but the spec needs adjustment.
January 29, 2026 at 11:15 AM