Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tricks to speeding up the load time... 1

Status
Not open for further replies.

nexius

Programmer
Jul 8, 2000
109
CA
Hey

I've almost finished a web page based on php but I find that the loading time is too slow.

Now, the php script is executed on the server, so shrinking the size of the php script isn't going to speed anything up, is it? ( I'm using some unnecessary includes that could be organized )

Then again, the time it takes to actually run the script is probably minimal compared to the time it takes to actually transfer the html to the user... right?
 
1. The PHP script is executed on the server: Yes.
Shrinking size may not so important as optimizing the code is. Includes probably add a few miliseconds for disk access, depending on the server.
2. We don't know how long the script runs or how long the transfer takes. Put in some 'breadcrumbs', i.e., echo the time it starts and the time it ends. That will give you a hint how long the script actually runs.
If that is just a short time and you wait for the page you have to look elsewhere.

Some browsers try to locate all parts of the document - so if there are broken links that do not resolve they just keep loading....
Those links could be
- preloaded images
- loaded scripts (<script src="...
- CSS files (<link href="...
and such like.
 
Thanks DRJ478.

I tried what you said, and outputed the total time it took to generate it... I couldn't believe that it was 7 seconds.

Obviously this needs optimizing
Thanks again
 
.58 seconds to generate and quick load time but I'm on highspeed cable...

thing(s) to look at
[ol]
[li]the background image(s), [/li]
[li]could dump the style stuff into a css link file,[/li][li]lots of js for the date boxes, could use php to write those, less code to send to the browser and less work for the browser to do (but six of one half a dozen of the other)[/li]
[li]merge the div align stuff into the td descriptor stuff
Code:
<tr>
   <td width="1%" height="2"> 
      <div align="right"><input type="checkbox" name="link_internally"></div>
   </td>
   <td width="99%" height="2" nowrap> 
      <div align="left">Link Internally</div>
   </td>
</tr>
to
Code:
<tr>
   <td width="1%" height="2" align="right"> 
      <input type="checkbox" name="link_internally">
   </td>
   <td width="99%" align="left" height="2" nowrap> 
     Link Internally
   </td>
</tr>
[/li]
[/ol]

All this will lighten the page somewhat...get marginally more speed from the smaller file(s)....


Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top