Re: [SMARTY] Benchmarking cache and inserts
| From: | Nino Katic | Date: | Fri, 06 Jun 2003 16:43:47 +0000 |
| Subject: | Re: [SMARTY] Benchmarking cache and inserts | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9665@lists.php.net to get a copy of this message | ||
On Fri, 6 Jun 2003, Paul Lockaby wrote:
> To begin with, render times vary widely depending on which server you're
> running the script on. For instance, at work when I use a 1.2GHz
> machine, it's faster than at home on my 466MHz or my 233MHz machine.
> They're all relative. With that said, I am surprised that you are not
> getting a faster render time with caching enabled. It is true that you
I'm working on Duron 800.
> can have each insert load another template and specify a different cache
> time (I have done this before and it did significantly increase render
> time, much more than you are reporting). So, In reality I find your
Can you show me this on an example. Currently my page looks like this:
main.php //main php file that includes classes, smarty
$smarty->caching = true;
code bla bla...
$smarty->display($phdisplay,$cacheid);
-----
maintemplate.tpl //includes html, smarty tags and couple of inserts
{insert name="images" template="foo" other vars bla bla}
-----
insert.images.php //here i have to put $smarty->caching = false; to work
properly
$smarty->caching = false;
code bla bla.
$sli_out =
$smarty->fetch($smarty->template_dir.'photo/'.$params['template']);
$photo->caching = true;
return $sli_out;
----
and that's it.. now how should i cache that insert and gain some speed?
> render times to be incredibly high, and that is one of the problems I
> have with Smarty: a huge overhead. One thing to note is that you might
> want to test the script from the command line to eliminate any
> transmission slowdowns. Also, I find this script right here to be a good
> timer:
>
> $timeparts = explode(" ",microtime());
> $starttime = $timeparts[1].substr($timeparts[0],1);
>
> // ... execute script ...
>
> $timeparts = explode(" ",microtime());
> $endtime = $timeparts[1].substr($timeparts[0],1);
> echo bcsub($endtime,$starttime,6);
I'm using similar example from php manual for microtime function.
Nino