Comments for Smarty PHP template engine

31 Jan 2001 16:35 mohrt

Re: Alternative

> If you can't use this class, and you
> have access to the php.ini file, you
> might be able to still add the APC
> Alternative PHP Cache zend extension and
> use a different template class.


I think there is some confusion about what Smarty is. Smarty is not a PHP caching solution. Smarty is a template engine. APC will merely speed up compilation of the PHP scripts themselves, but nither is an alternative to the other. They actually work very well together.

31 Jan 2001 16:25 mohrt

Re: Poor Performance

> Did a quick benchmark of Smarty vs
> phplibs templating. On a simple test of
> a 3 variable block of code repeated 20
> times Smarty served 65 page/s with
> compile_check = true and 80 with
> compile_check = false.
>
> phplib on the other hand served 90
> pages/s at all times. Not sure why this
> is.


The performance problem you are seeing here is the overhead of PHP compiling the op-tree for the PHP scripts on each request. Smarty is a more complex templating engine than phplib (and probably most others), therefore it has more code for PHP to compile on each invocation. If you do some benchmark tests using a PHP cache solution, such as Zend cache or APC, you will see that Smarty runs at least as fast, but most likely faster than conventional template solutions since there is no template parsing overhead.

See the smarty mailing list archive for more a more detailed discussion of this very subject.

31 Jan 2001 16:17 mohrt

Re: Limitation of Smarty

> This cached template system for PHP is a
> very good idea, but it works only for
> directory trees that are owned by the
> user running Apache. It's totally
> useless for a Unix user publishing in
> its private public_html directory.


One workaround to this problem, you can create a world writable directory for the compiled templates (owned by yourself obviously), then once the templates are initially compiled, change it back to read-only. Smarty will no longer need to write more files there once the initial compile is complete.

26 Jan 2001 21:00 augustz

Poor Performance
Did a quick benchmark of Smarty vs phplibs templating. On a simple test of a 3 variable block of code repeated 20 times Smarty served 65 page/s with compile_check = true and 80 with compile_check = false.


phplib on the other hand served 90 pages/s at all times. Not sure why this is.

26 Jan 2001 10:47 deekayen

Alternative
If you can't use this class, and you have access to the php.ini file, you might be able to still add the APC Alternative PHP Cache (http://freshmeat.net/projects/apc/) zend extension and use a different template class.

25 Jan 2001 22:53 marclavalle

Limitation of Smarty
This cached template system for PHP is a very good idea, but it works only for directory trees that are owned by the user running Apache. It's totally useless for a Unix user publishing in its private public_html directory.

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.