Profiling Yii

I thought this could be of interrest to some. I ran xdebug during a single request on the Yii blog demo (apc enabled, MySQL set up as backend) and came up with this:

2933

xdebug-yiiblogdemo.png

HTML Purifier is taking the lion’s share, which shouldn’t come as a surprise. But: A lot of time is spent in YiiBase (in particular autoload() and import()). This could mean that it may be very well worth it to always use yiilite.php instead of yii.php.

And in case you’re wondering: Next in the list is CDbSchema.quoteColumnName(). I’ll keep you updated ;)

nice… could you post list sorted by time consumed (which is on the left but only partially visible)?

I assume you mean sorted by self time? I’ll need some time for that since I’ll have to type that of.

Meh. Have some screenshots instead. Once without cycles, once with:

2935

yiiblog-funclist.png

I reached the same conclusion when I profiled with xdebug and KDE.

I must add that on production it is expected good idea, but during development I find this approach not ideal for me especially when using APC or x-cache

I rephrase

is it? It’s always advised in conjunction with APC. But not as a general rule of thumb.

thanks :)

It’s quite interesting: Apart from the loops in YiiBase, there’s really little room for performance improvements. Almost all possible optimizations either belong into the realm of micro optimizations (resulting into illegible, unmaintainable code) or refactoring (introducing almost certainly bc-breaking changes).

Note: It could be possible to replace those loops in YiiBase with the help of stream_resolve_incluce_path().

Can you guide me how to do it?