Knowing what makes your php script slow
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.
No Comments »
No comments yet.
RSS feed for comments on this post. TrackBack Website




