31 Oct

Knowing what makes your php script slow

Tuesday October 31st 2006, 7:04 pm
Tags: , , ,

Was wondering why my PmWiki installation was so slow. After some time digging into PmWiki’s internals, trying to understand how it transform wiki code into HTML, a failed attempt to implement some intelligent caching, the main problem turned out to be the cookbook recipe of many many many smileys. Everyone of them created a regexp which was evaluated on every view of every page of the site. At the end something like 150 regexps had to be processed in addition to the default ones. Not good for performance. And then there is this $EnablePageListProtect
variable in PmWiki. Looking so innocently, but it’s responsible for >200 file accesses on every pageview.

A great tool, XDebug, for profiling PHP code can be found here. Jeremy Knope’s Blog has a nice and easy explanation which worked flawlessly. Together with WinCachegrind it’s a perfect way to see where the cpu time is going.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • Reddit

No Comments »

No comments yet.

 

RSS feed for comments on this post. TrackBack Website

Leave a comment

(required)

(required)

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>