50 posts per page and 1000 smilies in the DB? Hmmm... I would be interested in the timing numbers with and without smilies enabled.
A couple of points about how it is done:
- Remember that no overhead is required if the post is coming out of the post cache.
- Once per page load the smilies are loaded from a cache, so that looping over the DB entries is not required.
- The work of doing the replacements is a loop that calls preg_replace for every smilie you have defined (50 in your case) -- a simple, but not efficient design.