Re: [SMARTY] Caching newbie questions
| From: | messju mohr | Date: | Fri, 04 Apr 2003 16:55:31 +0000 |
| Subject: | Re: [SMARTY] Caching newbie questions | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9096@lists.php.net to get a copy of this message | ||
On Fri, Apr 04, 2003 at 06:58:20AM -0800, Jacques Jocelyn wrote:
>
> Hello Alex,
>
> Friday, April 4, 2003, 6:32:19 AM, you wrote:
>
> A> why not just use the insert function and cache ids. besides, compiling 3
> A> templates is time consuming
>
> In my case, that will be worse, since I am using a dynamic menus(the
> menus can be different from one use to another) with SID(PHP SESSION ID)
> value within internal links therefore if I use the global cache,
> I will have a cache for each visitor which will be a nonsense.
>
> Besides, I had to create an class extension in order to replace old $SID
> value from the cache and display the current $SID.
>
> The performance decreased immensely !
> Without replacing the SID, I could generate the page in .30s
> By Replacing the SID, Now it is about .70s
> so if I have several templates to display, that might be a big issue.
400ms are a long time.
if you can use str_replace instead of preg_replace it is much faster.
also: output-buffering slows down the thing a lot. maybe it is faster
if you do
ob_start('replace_func')
$smarty->display
....
and doing the replacement inside replace_func(). then you don't have
to copy the output around with ob_get_contents() anymore. be sure to
make your output-buffer big enough, so that you don't have to deal
with overlapping chunks. i didn't bench the difference between the 2
approaches, but you may want to give it a try.
postprocessing will always slow down your page a lot. but maybe you
can lower the 400ms significantly (depends on you setup and a lot of
factors).
greetings
messju
> Best regards,
> Jacques JOCELYN