This is a discussion on Re: [PHP] Whats more efficient? (Conclusion) within the PHP General forums, part of the PHP Programming Forums category; Hey all, Thanks for clearing up my little doubt, I wanted to know if there was a major differience. John, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hey all,
Thanks for clearing up my little doubt, I wanted to know if there was a major differience. John, thanks for the reply and I know it makes sense (like all your replies) but I just kind of got my feet wet with php and getting to the interesting stuff, learning while i go along of course. I dont think I can take trying to learn a who new templating language/package while doing this because I hear some of them (eg smarty) can be quite tricky sometimes for the beginner...and I get enough PHP errors so dont want to add templating errors to that :-) Just one last question, you guys can reply to this off list or on: does using a templating engine slow down pages a lot (as i have heard) or increase speed (as i have heard again) ? :-D Cheers, -Ryan Chris Shiflett wrote: > --- "John W. Holmes" <holmes072000@charter.net> wrote: > >>Use a template engine to separate your presentation from your logic. :) > > > Isn't PHP a templating engine? :-) Of course it is, but what's that got to do with separating presentation from logic (business logic)? Each one can be PHP code... :) Bad answer, I know, because his code could be a PHP "template". I'm sure it's not, though. I just wanted to give a different answer from the many "it doesn't matter" answers. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com |
|
|||
|
Ryan A wrote:
> Just one last question, you guys can reply to this off list or on: > does using a templating engine slow down pages a lot (as i have heard) or > increase speed (as i have heard again) ? :-D Depends upon your application and the templating engine. Many options either way. In my cases, the benefit is easier code to maintain with no noticable slowdown. Good trade off for me. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com |
|
|||
|
--- Ryan A <ryan@coinpass.com> wrote:
> Just one last question, you guys can reply to this off list or on: > does using a templating engine slow down pages a lot (as i have > heard) or increase speed (as i have heard again) ? :-D Things like Smarty are slow in terms of performance alone, yes. The tradeoff is that the design these solutions allow might make life easier for the developers. If your applications are serving ten million requests a day, Smarty is going to be problematic, but you can still overcome this with some good server-side caching (for example, is it necessary to dynamically generate a response for every request if the data isn't very volatile?). Chris ===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp |
|
|||
|
On Tue, 2003-10-21 at 23:12, Ryan A wrote:
> Hey all, > > Thanks for clearing up my little doubt, I wanted to know if there was a > major differience. > > John, thanks for the reply and I know it makes sense (like all your replies) > but I just kind of got my feet wet with php > and getting to the interesting stuff, learning while i go along of course. > > I dont think I can take trying to learn a who new templating > language/package while doing this because I hear > some of them (eg smarty) can be quite tricky sometimes for the > beginner...and I get enough PHP errors so dont want to add templating errors > to that :-) > > Just one last question, you guys can reply to this off list or on: > does using a templating engine slow down pages a lot (as i have heard) or > increase speed (as i have heard again) ? :-D TemplateJinn (part of InterJinn :) is a compiling template engine. You can run it from the command line (or via a compile page) to generate your site, in which case there is no overhead whatsoever since the output is embedded PHP in content. The other style is to have it automatically compile missing files that have yet to be compiled, or compile updates -- this has a small overhead while it checks dependencies at page load time. Cheers, Rob. -- ..------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' |
|
|||
|
* Thus wrote Ryan A (ryan@coinpass.com):
> Hey all, > > Just one last question, you guys can reply to this off list or on: > does using a templating engine slow down pages a lot (as i have heard) or > increase speed (as i have heard again) ? :-D One thing I always try to avoid is having the template engine buffer everything while processing all the data from start to finish. In most cases a document has a top, left, content and bottom. And in standard conditions the top and left should be sent before the content is processed (which tends to take the longest to process). That way the page appears to load much quicker, than sitting there waiting for the website to respond with content while php is gathering all the html to send. Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ |
|
|||
|
* Thus wrote Chris Shiflett (shiflett@php.net):
> --- Ryan A <ryan@coinpass.com> wrote: > > Just one last question, you guys can reply to this off list or on: > > does using a templating engine slow down pages a lot (as i have > > heard) or increase speed (as i have heard again) ? :-D > > Things like Smarty are slow in terms of performance alone, yes. The tradeoff is > that the design these solutions allow might make life easier for the > developers. > > If your applications are serving ten million requests a day, Smarty is going to > be problematic, but you can still overcome this with some good server-side > caching (for example, is it necessary to dynamically generate a response for > every request if the data isn't very volatile?). (more i do things like...) I usually set up a minimum of 3-4 levels of caching: . regular document, only regenerate when last modified. (much easier if apache handles this) . Session lifetime. Things that change specifically to a session. Like last-login: . Per visit. although harder to detect, things like page counters. . per request. Usually this level means no caching but in certain cases this can fine tune performance under heavy loads. So when I set up a page I'll assign it a different cache level for it and generate a fresh copy depending on the level and all the rules I set up for the level. Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ |