Re: Contribution for PECL
| From: | Maxx | Date: | Sat, 28 Dec 2002 03:19:54 +0000 |
| Subject: | Re: Contribution for PECL | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11861@lists.php.net to get a copy of this message | ||
> That just shows you don't know smarty :-)
>
> Smarty compiles template code directly into native PHP code which is must
faster than a
> C extension that does a search and replace[1], and is (smarty) the best
way to do a templating
> language in PHP.
a) Smarty just can not be much faster than a well-written C extension. As I
said already, tests showed php-templates faster than pure PHP (even without
Smarty).
b) There is no any kind of search-and-replace operation in php-templates. We
do not replace the text in a template and the search algorythm used in the
code is really fast. The main idea is that engine _builds_ a template
instead of changing its parts. This approach increases the speed
_dramatically_. You may see that all in the source.
> [1] A C extension constantly reparses the template, Smarty parses and
compiles it once, mix
> Smarty with a PHP Cache (like ionCube Accellerator or Zend Performance
Suite) and it'll beat
> the C extension every time...
There's a "shared memory cache" task in my TODO list. It will be implemented
in one of future versions and the engine will stop doing any kind of
text-search operations.
The developing process has not been stoped yet.
> Did you read Monte's "why use smarty" page on smarty.php.net ? It
> explains quite well why trying to have "no logic in the template" is
> useless... You NEED logic in your template. If it's not in the
> template, it's in the code, and if the design depends on this code,
> then you don't achieve the layout separation you were using templates
> for. Final dot as far as i'm concerned...
Just a citation from the mentioned article:
"We'll start by saying that [XXX] doesn't claim to be the answer to every
templating problem. It isn't, nor is any other template engine. There is
always going to be more than one way to solve a problem. It is up to you as
the application designer to identify your needs and use a solution that
works best."
I replaced "Smarty" with "[XXX]" intentionally just for you could apply the
text to any template solution. =)
P.S. Let's stop the holy war and discuss pros and cons of the topic.