Hi,
While porting the t.e.o theme to Trac trunk I noticed that the /roadmap
is very slow, and it takes at least 1.5-2 seconds to render that page.
Almost all of that time is apparently spent by the permission system
making sure the user isn't shown any ticket he/she isn't supposed to
see:
(roadmap.py:267)
def apply_ticket_permissions(env, req, tickets):
"""Apply permissions to a set of milestone tickets as returned by
get_tickets_for_milestone()."""
return [t for t in tickets
if 'TICKET_VIEW' in req.perm('ticket', t['id'])]
If I'm reading perm.py correctly PermissionCache only caches repeated
permission checks on a specific resource and action and not repeated
checks on different resources in the same realm. This means that the
apply_ticket_permission function will generate hundreds if not thousands
of cache misses for larger Trac installations.
What's even worse is that each and every cache miss results in a call to
DefaultPermissionStore.get_user_permissions() which in turn executes a
"SELECT username,action FROM permission". So almost all of the 1.5-2
seconds are spent on repeatingly querying the database for the same
information.
I don't know perm.py well enough right now to come with a good
suggestion for how to fix this. But imho we need to find a way to
improve the cache before 0.11 is released.
Cheers,
Jonas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---