Here is some more information about the behavior I'm seeing. I created a template with only hard-coded content in it:
<head>
<title>Hard coded page title</title>
</head>
<body>
<h1>Hard coded heading</h1>
<p>Hard coded content</p>
</body>
</html>
And I created a page with no content in it at all. It has a page title and an alias and nothing else. I made this page NOT cacheable, to test the raw processing speed. The page is NOT a member of any resource groups. There are NO template variables associated with this template.
Here's what I found:
On average, the network request/response time is as follows:
- Not logged in: 54ms
- Logged in: 28ms
If I add the page to a resource group that is available to the anonymous user group, the resulting speed is as follows, on average:
- Not logged in: 76ms
- Logged in: 28ms (no change)
If I add template variables, the speed decreases overall, whether logged in or not, but much more when not logged in. On a complex page with a lot of content and template variables and logic, the results are as follows:
- Not logged in: 1800ms (nearly 2 seconds)
- Logged in: 176ms
Conclusion:
So no matter what I do, unauthenticated page load time is always significantly more than the authenticated page load time (in the absolute simplest use case, it is about double the load time), which seems backward from what it ought to be. I would think that it takes less work to NOT check permissions than to check them.
And the more options I add to pages (resource groups, template variables, programming logic), the greater the gap. In my resource-intensive page, the anonymous page load time is slower by about a factor of 10.
Any insights as to how to fix this?