Hello,
I notice that the method allowedContentTypes cost time when you have a lot of type in plone2.5.I don’t know if plone3 or plone4 are impacted of that. I have 120 types and the time of execution of context.allowedContentTypes is about 0.32sec.
The path of allowedContentTypes is :
allowedContentTypes -> portal_types.listTypeInfo -> for each content type: portal_types.isConstructionAllowed -> portal_types._queryFactoryMethod -> Products.Five.pythonproducts.patch_ProductDispatcher__bobo_traverse__ -> Products.Five.pythonproducts.product_packages
and Products.Five.pythonproducts.product_packages time call is 0,003s
When you have 100 content type only product_packages is responsible of 0,3sec , this method is a performance bottleneck.
So add this patch fix the problem :
from Products.Five import pythonproducts
old_product_packages = pythonproducts.product_packages
pythonproducts.product_packages = forever.memoize(old_product_packages)
Regards Youenn