[wp-hackers] Profiling Wordpress filters and actions
Johan Eenfeldt
johan.eenfeldt at gmail.com
Thu Jan 8 03:02:15 GMT 2009
Hi,
I've spent some time recently profiling the performance of filters and
actions in Wordpress and thought I should write down some of what I've
found in the event that anyone else is interested.. :)
Summary[1]:
Filters take ~12% of the total page creation time on home page, 63% on
a page with 400 comments.
The most expensive ones are, without any competition, the ones in
(among other places) 'the_content' and 'comment_text'. They take 6.2%
of total time on homepage, 62.2% on a page with 400 comments (this
used to be ~82% until someone changed convert_smilies() :) ).
If you want spend some effort optimizing things and make it count this
is the list: wptexturize 18%, wpautop 17%, make_clickable 14%,
convert_smilies 10% (used to be 55%).
That is percentage of total page creation time on that 400 comments page.
Actions take almost no time.
Numbers overview[2]:
Loadtime homepage:
v2.6.5: 0.440s, Filters/Actions: 0.073s (16.6%), Db: 0.032s (7.3%)
Trunk: 0.436s, Filters/Actions: 0.052s (11.8%), Db: 0.031s (7.1%)
Loadtime post with 403 comments:
v2.6.5: 7.052s, Filters/Actions: 5.856s (83%), Db: 0.033s (0.5%)
Trunk: 3.439s, Filters/Actions: 2.174s (63.2%), Db: 0.036s (1%)
Thank you for reading,
Johan
[1] Measured current trunk (10331) with all plugins turned of, except
homebrew profiling. Numbers vary quite a bit between pageloads but
percentages stay pretty even. The profiling adds up to ~5% on total
time, should be mostly outside the filter numbers. This is just from
my computer at home. Beware of statistics.
[2] Remember [1].
More information about the wp-hackers
mailing list