Jump to content

Functions vs Includes (for speed)


MrCat

Recommended Posts

My programming technique has tended to be short pieces of code as separate files, and then including them in a main page. I like this from a management point of view because it makes things easier to read than scrolling through long files.

 

I've been wondering if I should worry about any extra server load or time penalty in doing this?

 

Should I switch my style to longer files that contain multiple functions?

 

Link to comment
Share on other sites

Just a side note...you may already do this...but I inevitably wind up with huge files mostly because I group things by logical function.  What I've always done is use tags and just search for the tags.

 

Ex:

<?php

//Tags: post,print array, processing
function myFunction(){
   echo "Doing some processing...";
   print_r($_POST);
}

//10,000 lines later...

//Tags: mysql, query, last
function lastFunction(){
   echo "This is the last function, I swear...";
   mysql_query();
   mysql_close();
}

 

Its obviously a very manual way to do it but its definitely easy to just "Find" a tag than to find something by scanning.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.