![]() |
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? |
Are you using something like xcache, an opcode cache? It may not be as significant an issue as you're thinking if so.
|
Quote:
|
You should look into the caches he mentioned.
|
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
|
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? |
4500 lines of code is nothing and unless the functions run processor intensive tasks, the effects would be negligible.
|
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..
|
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...
|
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. |
All times are GMT -7. The time now is 06:21 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123