So, I am building a web app that will need to be extremely fast, do finish a perticular task a single function will be called and the page will refresh calling that function and refreshing again, rinse repeat. Now, for the sake of execution time I have done certain things to help, like replaced preg searches with strpos and strstr so the regex engine doesnt have to start everytime the function has been called, ive also chosen to concentate strings instead of using sprintf, etc. My biggest concern now is whether have like 5 or 6 functions, totaling 1000 lines of code all in one file will show a significant slow down compared to every function being broken out into seperate files where only required code for that function is present. In the same realm, will there be any significant in using OOP techniques by making classes, extending classes, etc VS. good ol fashion stand alone functions.
It depends on how or when the functions need to be executed. There are costs in loading and parsing a large file, and there are also costs for opening a new file. So best will be to keep related functions in the same file, and others separate. In general, OO is slower than non-OO. NOTE: The above answers only consider about the code execution speed. You should consider the code readability and maintainability as well.
Yup phper is 100% correct There is a certain amount of overhead in creating objects that can slow down your script (albeit a fraction of a second) Is it necessary for your whole page to refresh? Can you just do an AJAX call and update the part that needs to be dynamic. This might cut down on your function calls.