views:

16

answers:

1

I'm working on a codebase with a lot of non-OO function libraries, and personally, I don't love php's java-inspired OO model.

Unfortunately, I'm trying to solve the problem of the overhead that you get with a lot of included libraries, and see a lot of recommendation for autoloading. Which only works with classes.

Is there any way to reduce the overhead of included libraries of functions in a manner like autoload? By making use of php 5.3 namespaces, say?

I certainly don't want to move all of these (often diverse) libraries of functions to classes to get performance gain (the bugs wouldn't make it worth it), so is there a simpler way to optimize function library includes in simple ways?

Is inclusion of function libraries in php just fast enough that I shouldn't worry about it?

A: 

No, the autoloader only gets called when instantiating unloaded classes. You can't use it for functions.

halfdan
I get that autoload itself will only work for classes, I'm looking for a parallel solution for function libraries.
Tchalvak
Clarified the title a little to emphasize that.
Tchalvak
There's no way of "autoloading" anything that's not a class. You need to wrap the library functions into a class..
halfdan