Re: Re: Functions vs html outpuit
| From: | Larry Garfield | Date: | Sun, 03 Sep 2006 16:54:22 +0000 |
| Subject: | Re: Re: Functions vs html outpuit | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241344@lists.php.net to get a copy of this message | ||
On Sunday 03 September 2006 09:00, Alex Turner wrote:
> I would go for the optimize late philosophy. Once you have a site
> running, load testing it with - eg - JMeter. If a PHP page is taking a
> lot of the time and it could easily be converted to static HTML, do it
> at that point. If you code raw HTML everywhere, then you might find
> that you have spent a day messing with a page that only gets hit once a
> day :-(
>
> Best wishes
>
> AJ
"Pre-mature optimization is the root of all evil."
Unless you're building something you know will be very time sensitive, or a
part of the code that you know will run every single page view, optimize
first for maintainability/modifiability. That is, write code that is easy to
understand and easy to tweak. That means opting for generalized, flexible
code when possible. Sometimes that will mean writing all your HTML via
print, sometimes it will mean static HTML files (although it almost never
does for me), sometimes that will mean including a mostly-HTML file with PHP
print statements into a mostly-PHP function to use as a poor man's template.
In my experience, the time it takes to connect to your SQL database in the
first place will be an order of magnitude larger than whatever it is you're
doing anyway. :-)
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson