Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
kono
New Member
New Member



Joined: Jun 21, 2004
Posts: 2

PostPosted: Mon Jun 21, 2004 2:11 pm Reply with quote

Hello,

I'm currently in the middle of coding a large custom PHP-Nuke module (currently 75KB, may end up around 200), and I'm wondering what steps I can take to improve the loading time of pages in the module.

I see that I can break the module into separate files, and use the &file= URL parameter to access functions in those files. Before I go down that path, I'm wondering if anyone has tried this, and if it offered a noticeable performance improvement versus the monolithic approach.

Other than that, I'm wondering if anyone has any other optimization-minded tricks of the trade to share. This is my fourth custom module for my site, but I still consider myself quite the PHP rookie.

kono
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Mon Jun 21, 2004 2:23 pm Reply with quote

Well, as a general rule, anytime you include from other files you are incurring overhead, so that's not the way to go. What is causing the large size? Mostly static html or server side code?
 
View user's profile Send private message
kono







PostPosted: Mon Jun 21, 2004 2:41 pm Reply with quote

Raven wrote:
Well, as a general rule, anytime you include from other files you are incurring overhead, so that's not the way to go. What is causing the large size? Mostly static html or server side code?

I'm talking about something a little different than includes. The Addon_Sample folder contains an example of what I'm talking about.

You can have index.php and index2.php be part of the same module, and your URL has to look like "domain.com/modules.php?name=module_name&file=index2&op=..." to access functions in index2. You wouldn't include one from the other, so you can't actually call functions across the files, but if your module has multiple page traversals, and very little common code between them, it looks like you can break them down into discrete chunks.

I'm hoping this might eliminate a lot of overhead in my situation, which is a mildly complex database entry module with a couple dozen distinct pages. I have a couple pages which are just menus, maybe one query and a few echo statements, and I still see load times that exceed those of my forums.

I guess the real question I need to ask is this: When you navigate to "modules.php?name=module_name", the PHP engine has to parse all of index.php, and everything it includes, correct? Would limiting the amount of code per file yield any significant benefit?

kono
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©