UUID and performances

I love the new uuid feature. Just to know - having performances in mind, which is the fastest way to find a page? By uuid or by URI? I would say by URI, but… (of course I’m talking about a site with thousands of pages)

I mean
page('page://Xv243VTLMBKva7gu')
vs
page('projects/2022/09/the-wooden-chair')
?

Hm, good questions. If it was only about comparing reading the file system vs. having to check the content files for the stored UUID, then going by URI would be faster.

However, the UUIDs are cached, so it should actually be fast.

Always by URI. When you know the direct way to a page in a file-based system, that will always be faster then when you have to look up the way first (what UUIDs do). Caching for UUIDs makes this look-up very performant, but will never be fast than skipping the look-up cause you already know the path.

So don’t be mistaken: UUID is not a performance feature. While cached UUIDs will be very fast, even on sites with thousands of pages, their main purpose are reliable relationships: getting the right directions to a page without knowing the directions first and no matter how often the directions/path have been changed. But if you already know the exact current directions, that’ll always be faster. Maybe not by a lot, but it won’t be the other way around.

5 Likes