Problem/Motivation
I was profiling some stuff and noticed that route preloading takes up a considerable amount of memory, about 1.5MB in my project.
As a logged in user with navigation module enabled, I also saw 9 calls to preloading routes. (note: 9 calls that actually called into the cache)
2 of those are in early bootstrap from #3503841: RouteNormalizerRequestSubscriber causes two extra route cache lookups.
Then there is a huge list from preloading, 168 routes in my case. Lots of things from layout builder (23 in total) , entity browser, many entity routes such as edit, delete, revision view/revert/delete, autocomplete callbacks, sitemap and more.
Then several more calls from navigation module because it loads each section separately from the menu tree. I believe that this would go away once we improve caching there, as we can properly cache the full navigation section, so not focusing on that here.
Steps to reproduce
Proposed resolution
I kind of see two options. One is to lower the amount of routes we preload, add some more checks, maybe check the is_admin flag instead.
But I'm wondering if there's a different solution. It's only a vague idea at this point, but what if we instead of a full preload, only flag those routes to use a ChainedFast bin (bootstrap?) when requested, but then only load them when actually used?