Re: [SMARTY] Smarty-Light

From: Date: Wed, 14 Jul 2004 22:52:12 +0000
Subject: Re: [SMARTY] Smarty-Light
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11592@lists.php.net to get a copy of this message
only by the way, because of the final release of php5. php5 spawns a method to load classes on demand using the __autoload function. A callback, which is called, when php5 doesn't found a used class. Theoretically you could now split the big bunch of smarty code into two pieces. One lightweight caching module, and the other big, but flexible, smarty parser, compiler, ... . So only if no cached template is found, the parser would be loaded. Could save a lot of php parsing time. On the other hand, php5 is not established as much, as something like that could be implemted, without mechanisms, forcing php4 and below, to ignore that code. And ... i have absolutly no idea how php5 handles multiple __autoload definitions. A reserved __autoload callback could be bring much more problems as it actually solves. But is there no other possibilty to load the smarty code internally on demand. Perhaps using require(_once), or something? Vonleigh Simmons wrote:
One should always strive to write compact, fast, and efficient code.
    Or one could strive for well written, orthogonal, easily maintainable and expandable code; then later strive for performance. Early optimization is the root of all evil; but this is just my philosophy and it's great that one as a programmer has many philosophies to choose from.
    In my case I rely on objects, straight scripts or whatever is more appropriate in my PHP, that allows me to do more with less. After I'm done I profile and if anything is too slow I can rewrite or send off to another language like perl.
    During my profiling smarty hasn't been the bottleneck. In fact it has alleviated many by using the caching, so that the slower operations only need to be generated once every month in some cases. I do have mmcache installed.
    This is not to say that your project doesn't have merit. In an environment with an extreme load, where one can't get more hardware or more hardware doesn't help, or when the content changes so quickly that caching isn't very effective; if one profiles the code and it turns out that smarty is the slowest component, then your project would fit perfectly. I could think of friendster where they have had serious performance trouble with both java and php.
because I didn't like some of the syntax issues (backticks for concatenation? why not use the PHP and Perl method of putting a dot between strings?)
    I have to agree with that. The dot between strings is much more friendly. Any idea why it's not in smarty?
But a speed demon it is not.
    In my case it doesn't matter. One has to find the slowest components and optimize those first to net the greatest speed difference. In my case it hasn't been smarty so far.
    Maybe someone can do some tests with mmcache enabled.
Vonleigh Simmons <http://illusionart.com/>


« previous php.smarty.general (#11592) next »