Re: Smaller Size?

From: Date: Wed, 23 Jan 2002 20:01:48 +0000
Subject: Re: Smaller Size?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2573@lists.php.net to get a copy of this message
Hello! I'd like to add my 0.01 euro-cents :) to the discussion. While I generally support the idea of optimizing code, while still being reasonable (*), I think one should not forget that in many cases, the time and money you save through using an additional abstraction layer like the one provided by Smarty, is far bigger than the amount of time and money you need to upgrade your processing power. For many bigger webprojects, it is still way cheaper to use Smarty and buy some more CPU power, then not to use Smarty at all. Now, on the other hand, if someone has a good idea to reduce Smarty's size, go ahead. Oh, there are a couple of "intermediate" solutions, like using the Zend Optimizer, that also bring a nice (free) speed increase. Bye! (*) Optimizing code should not be the sole purpose of writing code, but merely part of it. Some people think that optimzing code is the only reason that makes their life worth living... ----------------------- Alain Fontaine Consultant & Developer VAlain S.A. Tel: +32-4-2522950 ----------------------- -----Original Message----- From: mohrt@ns3.ispi.net [mailto:mohrt@ns3.ispi.net]On Behalf Of Monte Ohrt Sent: Wednesday, January 23, 2002 8:45 PM To: smarty@lists.ispi.net Cc: smarty@lists.ispi.net Subject: [smarty] Re: Smaller Size? Hi Brian, As for add-ons, I'm speculating a good part of the code will be modularized with plug-ins. Andrei has that task on his TODO list, I'm not sure how close he is to looking at it. As for other things, it isn't terribly easy to pull everything apart since PHP does not (yet) support the ability to dynamically add methods to classes. We already did this somewhat by pulling out the compiling code to another script and extended the class when it was needed. You can see that this is not as clean as we would like it to be. There are other work arounds too, there is a nice class in PEAR to emulate adding methods, but it does create a performance impact which is something want to avoid. When PHP does support adding methods to classes, we'll look at that again. Another alternative would be to make a stripped down version of Smarty, then you get into an issue of what stays and what goes, and who is going to support it. You're always welcome to strip out whatever you don't want for your own needs. Not a long term solution, I know. Monte "Brian E. Lozier" wrote: > > Is it possible to make Smarty more compact and "modularized?" What I mean > is, it seems like a very large class (over 1500 lines), most of which > doesn't seem to get used on a typical page, especially once the app is in > place. > > It seems like you could do the same with other functions as you have with > the compiler class - make different classes for the config, caching, etc., > all included only if they're needed for a specific page. > > Like, I never use config files, or these strange function things you have > written in all over the place (to allow people to add their own functions, > maybe?), or these 'addins,' debugging, or any other strange functions. > > I don't use anything (unless it's called internally) from the custom_funcs > or the custom_mods. > > It seems like Smarty is touted as being all fast, which is probably true, > but it could be faster if it didn't load so much in the class itself. > > if($this->caching) { > // include class.smarty.cache.php > } > if($this->debug) { > // include class.smarty.debug.php > } > > It just seems like 1500 lines for the base class, and over 800 for the > addins class, all loaded each and every time a smarty page is called, seems > a bit excessive. Especially if the template is already cached/compiled and > you don't need any of the other stuff that's included with the class. > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/ --- You are currently subscribed to smarty as: alain@valain.com To unsubscribe send a blank email to $subst('Email.Unsub') Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/

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