Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-30-2010, 10:43 PM   #1
goldfish
Confirmed User
 
goldfish's Avatar
 
Join Date: Jan 2009
Location: Somewhere east of the Mississippi
Posts: 723
PHP Programmers - A question

I was under the impression function files as includes were for frequently used functions so as to keep from having to repeat them.

So I am rebuilding a script and I came across a function file, 4566 lines long!

Many of the functions found inside are single use functions meaning they are called by one file and then never used again until the next time that file calls it again.

So my question on a high traffic site should these these single use functions be placed in an include file or the file that is calling it when my focus is speed and server load impact to a minimum?
__________________
ICQ: 566990329

"There is no rest for the wicked... and porn purveyors!
goldfish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-30-2010, 10:44 PM   #2
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
Are you using something like xcache, an opcode cache? It may not be as significant an issue as you're thinking if so.
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-30-2010, 10:51 PM   #3
goldfish
Confirmed User
 
goldfish's Avatar
 
Join Date: Jan 2009
Location: Somewhere east of the Mississippi
Posts: 723
Quote:
Originally Posted by Brujah View Post
Are you using something like xcache, an opcode cache? It may not be as significant an issue as you're thinking if so.
Nope....
__________________
ICQ: 566990329

"There is no rest for the wicked... and porn purveyors!
goldfish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-30-2010, 10:53 PM   #4
KillerK
Confirmed User
 
Join Date: May 2008
Posts: 3,406
You should look into the caches he mentioned.
KillerK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-30-2010, 10:54 PM   #5
Brujah
Beer Money Baron
 
Brujah's Avatar
 
Industry Role:
Join Date: Jan 2001
Location: brujah / gmail
Posts: 22,157
use an include file, the pros outweigh the cons, but if server load and speed is an issue you should look at the opcode caches anyway
__________________
Brujah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-30-2010, 11:09 PM   #6
goldfish
Confirmed User
 
goldfish's Avatar
 
Join Date: Jan 2009
Location: Somewhere east of the Mississippi
Posts: 723
Quote:
Originally Posted by Brujah View Post
use an include file, the pros outweigh the cons, but if server load and speed is an issue you should look at the opcode caches anyway
Would that answer change if I told you most of the function are just simple form interpetation, MYSQL queries and output from those queries?

Will definitely look into cache issue thought!

the biggest problem i may have with caching is this scripts makes tons of calls to another script(One I don't have control over) which uses its own programming language and an interpeter of some kind before it gets to the users browser and it is EXTREMELY tempermental.

So here is a question then, is 4500 lines of code in one file considered alot? excessive?
__________________
ICQ: 566990329

"There is no rest for the wicked... and porn purveyors!
goldfish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2010, 12:27 AM   #7
LustyVixens
Registered User
 
LustyVixens's Avatar
 
Join Date: Feb 2010
Posts: 79
4500 lines of code is nothing and unless the functions run processor intensive tasks, the effects would be negligible.
LustyVixens is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2010, 12:44 AM   #8
Jakez
Confirmed User
 
Jakez's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
Is 4500 lines of codes nothing? I think 2 lines of code could be SOMETHING depending on what they are.. hell I could very easily fit and entire tube script into 4500 lines..
__________________
[email protected] - jakezdumb - 573689400

Killuminati

Last edited by Jakez; 03-31-2010 at 12:45 AM..
Jakez is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2010, 04:44 AM   #9
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
4500 lines of code could be 200-300k in size, if you were compiling (once) the CPU time it takes is probably equivalent to an ant fart, but if it happens every page load the effect could be more noticeable IMHO. PHP isn't exactly efficient...
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-31-2010, 05:37 AM   #10
LustyVixens
Registered User
 
LustyVixens's Avatar
 
Join Date: Feb 2010
Posts: 79
Quote:
Originally Posted by Jakez View Post
Is 4500 lines of codes nothing? I think 2 lines of code could be SOMETHING depending on what they are.. hell I could very easily fit and entire tube script into 4500 lines..
He mentions the file contains functions and as I mentioned, there would be no obvious impact if the functions don't perform CPU-intensive tasks (in which case there would be an impact anyway, even if the intensive code was in its own file). Rather than concentrating on the number of lines as an indication of "excessive", rather ensure that the code within the file is written efficiently and clearly.

I of course don't support loading a file up with so many functions - it makes it hard to maintain. Optimal use of design patterns (notably MVC) should allow you to modularise your code more efficiently.
LustyVixens is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.