Unless you've benchmarked your application and found this to be a real problem, I wouldn't worry about loading a little extra code. Other issues will be more important. Does your site use authentication? Don't reauthenticate every page (seems obvious, I know, but I'm supporting an application that does this - and I can't change it because my group does not control the authentication module) - use Apache's native authentication or an encrypted cookie instead. Cache database queries when appropriate. Instead of keeping session information in the database or on the server, keep it in the user's (encrypted) cookie. Javascript, while annoying to write (and a possible accessibility issue), can help you avoid unnecessary hits on the server. For instance, instead of redirecting server-side, you can redirect client-side - instead of reloading the page to get a secondary drop-down list, create the list dynamically. I once wrote a file manager application that loaded the user's entire directory structure into a javascript hash - then the user could navigate through his/her directories without hitting the server again - javascript would rewrite the page as appropriate (this was necessary because the users were in South America with slow connections and the server was in New Jersey). If you duplicate (at least some) form validation client-side, you'll have fewer resubmits, which will lighten the load on your server (I said "duplicate" because you'll still have to do all the validation server-side, since you can never trust information from the client). If you're writing a web based application (file manager, mail client, quality record system, chat room, etc) rather than something people will want to bookmark (a news-site, blog, etc), frames (although unfashionable) might be appropriate - they divide the application into discrete units (for a three-frame application, usually main navigation, secondary navigation, and the active screen) and make it so you don't have to reload parts of that application that aren't changing. If you do use frames, be sure to include code to maintain frame state (if a frame is loaded independently, redirect to the frameset). Even if your project doesn't lend itself to frames, you can still cache sections of the page, like navigation, polls, etc.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|