![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
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! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Beer Money Baron
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.
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Jan 2009
Location: Somewhere east of the Mississippi
Posts: 723
|
Nope....
__________________
ICQ: 566990329 "There is no rest for the wicked... and porn purveyors! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: May 2008
Posts: 3,406
|
You should look into the caches he mentioned.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Beer Money Baron
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
__________________
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: Jan 2009
Location: Somewhere east of the Mississippi
Posts: 723
|
Quote:
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! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Registered User
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.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
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..
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
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...
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Registered User
Join Date: Feb 2010
Posts: 79
|
Quote:
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. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |