[UPHPU] faster? switch, if, or variable function

Jim Anderson jim.anderson at techiegroup.com
Thu Aug 9 11:12:22 MDT 2007


cole at colejoplin.com wrote:
> My concern is the first part of your statement. If the 50 functions 
> are almost identical, lots of repeated code, I'd make a new function 
> to replace them and make better use of input parameters. 100 lines of 
> good code usually outperform 5000.

I had a similar thought. My thought was, does the script flow in a way 
that all of the functions are used each time the script is run or does 
procedural determine which functions get called, of the ~50? If the 
fifty functions don't always get called, I would suggest that splitting 
them up into separate includes that only get included when needed may be 
a performance improvement. Less code for php to ignore [which takes 
system time to do.]

If, on the other hand, all ~50 functions get called every time the 
script runs, the single include method would be better.

And to touch the initial question, I *think* the switch would be 
[minimally] quicker.

-jim



More information about the UPHPU mailing list