CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Faster page loading

Print topic Send  topic

Author Message
Brent
Posted: 02/01/2002, 2:11 PM

I'm wondering if putting my PHP library, which is a file containing set of
functions used by my application, in the Modules / Global Functions event is
such a smart idea if I expect to have a heavy demand on my website.

The library is currently 650 lines of code and will get loaded on every page.
CC puts my library in an Include() statement in the common.php file, and this
common.php file appears at the top of each generated CC page.

This means PHP has to parse my PHP library every time a page loads. I'm thinking
a better way would be to store each PHP function as a separate file
and put them in an include directory. Only the functions that are used in the
page would be included in the Page's Custom Includes event.

Is this a better approach than to put all the functions in one file? TIA

Brent
Nicole
Posted: 02/04/2002, 4:52 AM

Brent,
I agree with your idea using Custom Include event to include .php file rather than include it to common.php
Brent
Posted: 02/04/2002, 7:47 AM

Yes, but for the fastest page loads, do you also agree that each include file
should contain only 1 (or more if the functions are related)? Because
most of the pages only use < 5% of the functions. The other 95% aren't referenced
by the page so why have the PHP interpreter parse it on each page load?

My current PHP library is over 650 lines of code and could easily
reach 1000+ lines. But by splitting the PHP functions into separate files
and putting them in an include directory, and explicitly including them
individually for the page, I'm not slowing down my website. Each page only
gets the PHP functions it really needs which reduces work on the interpreter.

I think this is the best way to go on a heavy traffic site. What do you think? :)

Brent

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.