Re: Question regarding slow page loading with attr set
Petko Yotov <[email protected]> Sun, 14 Apr 2024 14:42:14 +0200
| Newsgroups | gmane.comp.web.wiki.pmwiki.user |
|---|---|
| Message-ID | <[email protected]> |
On 14/04/2024 13:41, Hans Bracker wrote: > see this > post this > edit this > admin this > upload this ... > You can see the five extra calls to ReadPage in case 2 and 3, Do you have 5 different levels (read, post, edit, admin, upload)? If so, it is normal that the page file is opened 5 times. Permissions are cached per page and per level, or per "page+level". So you had "page+read", "page+post", etc. each calling RetrieveAuthPage, then cached. If you had 5 times (:if auth edit:), it would cache the "edit" level perms for the current page the first time, and for the next ifs it would return the cached perms and not reopen the page. Before the latest revision, 5 times (:if auth edit:) would open the page file 5 times, one for each "if" and verifies the password, if any. Now it opens and verifies the first time only. > and case 2 is a lot faster, as fast as without conditionals! It seems your operating system is caching recently opened files, like mine. Which suggests, as I suspected, that most of the time is spent verifying a password. RetrieveAuthPage is complex to change, as it may return a page with full history or partial history, or only the latest text and metadata. The conditional markup, and many recipes, don't need this, they only need to check the permissions. Maybe we can add a new function optimized for checking permissions only, that will return neither the page text nor the history, but will cache the page attributes so that they could be re-checked for different levels without reopening the page. But if the password verification takes most of the time, the improvements may not be noticeable. Petko