[Setup] huge performance issues using Diazo

Laurence Rowe l at lrowe.co.uk
Thu Mar 29 10:56:49 UTC 2012


hvelarde wrote
> 
> just to let you know how we reduced the process time from 25 to 2.5 
> seconds: we changed most conditional rules from CSS3 to XPath selectors.
> 
> here is an example:
> 
> -    <rules css:if-content=".template-section-view,
> -                           .template-opinion-view,
> -                           .template-opinion-interview-view,
> -                           .template-opinion-context-view">
> +    <rules if-content="//*[contains(@class, 'template-section-view')] or
> +                       //*[contains(@class, 'template-opinion-view')] or
> +                       //*[contains(@class, 
> 'template-opinion-interview-view')] or
> +                       //*[contains(@class, 
> 'template-opinion-context-view')]">
> 
> Diazo documentation states that: "CSS selectors are replaced by the 
> equivalent XPath selector during the pre-processing step of the 
> compiler. Thus, they have no performance impact."
> 
> this seems to be false according to what we have found.
> 

No, your selectors are not equivalent. The xpath "//*[contains(@class,
'template-section-view')]" matches any element with 'template-section-view'
in the class. That could be  or equally 

The reason it is so slow is that every single rule you have is testing that
there is any element in the page with that class. Those are body classes and
you should be restrict them to the body element where they appear, i.e.:



This should reduce your XSLT execution time by two orders of magnitude.



> I would love to give you more information on this, but the guy who 
> actually wrote the rules is a little bit busy right now.
> 
> it would be great to have some sort of tool to test performance for 
> rules files before deployment.
> 

It would be great to have a diazo debug toolbar with this sort of
information. We'll probably get around to it eventually, but if anyone is
interested in sponsoring such work do email me.

Laurence

--
View this message in context: http://plone.293351.n2.nabble.com/huge-performance-issues-using-Diazo-tp7372056p7417171.html
Sent from the Installation, Setup, Upgrades mailing list archive at Nabble.com.


More information about the Setup mailing list