User login |
Zend_Locale performance issuesFor my current contract at www.workhound.co.uk I am using various elements of the Zend Framework and Doctrine for ORM. I was experiencing very poor performance on certain pages, all of which had calls to the ORM layer on them which at first led me to think it might be database calls or Doctrine. After writing a quick bit of code to output the database queries and execution times I could clearly see that it was nothing to do with the SQL calls on the database, all the queries came back sub one tenth of a second. Thinking it might still be something to do with Doctrine I switched on xdebug and took a look at the output from one of the slow pages. What I found was over 6k of calls to the xpath function, the trace showed it came from Zend_Locale classes. On this page was about 30 peices of locale sensitive data spanning numbers, currencies and dates. A bit of searching brought up very little information on performance issues with Zend_Locale that seemed relevant to me so I took a look at the framework docs, specifically a tiny paragraph on "speeding up Zend_Locale and its subclasses" which tells you to statically set a Zend_Cache instance into the Zend_Locale class. I did as told and sure enough the page I profiled went from about 2.5 seconds to 0.5 seconds execution time and the 6k of calls to xpath dissapeared. In summary then, if you are using Zend_Locale in a production environment do not use it without Zend_Cache because the performance is absolutely awful without it.
Reply |