[Zope-CMF] [Performance] "listFilteredActionsFor" unnecessarily expensive

Alec Mitchell apm13 at columbia.edu
Wed Apr 6 01:44:00 EDT 2005


On Tuesday 05 April 2005 10:13 pm, Andreas Jung wrote:
> --On Dienstag, 5. April 2005 22:29 Uhr +0200 Dieter Maurer
>
> <dieter at handshake.de> wrote:
> > In our case, "listFilteredActionsFor" spends about 70 percent
> > of its complete time in the checking of "action in catlist".
>
> I did some profiling last week because Limi complained also about
> the slowness of the same method. My profiling (with a fresh
> Plone installation) told me that about 70% of the time is spend
> within the loop where  all action providers are asked to return
> a list of matching actions. However Plone implements its own
> listFilteredActionsFor() method which might be different from the
> original CMF code.

The two versions are nearly identical (at least for CMF 1.4.7 v Plone 2.1); 
Plone has extra checks to handle FactoryTool and to handle broken/missing 
action providers.  I am a bit surprised that this simple check would take 70% 
of the time as it's only evaluated for actions that pass the condition and 
permission checks, which would seem to be more expensive.  I'd expect the 
evaluation of the conditions to be much more expensive, but if there are many 
actions available, looping through a portion of them for each available 
action could be quite expensive.  I'm sure it all depends on the specific use 
case.  Whatever the case, this check is almost certainly unnecessary, whereas 
the condition checks are unavoidable and difficult to optimize.

Alec


More information about the Zope-CMF mailing list