一个文件中的更多类 - 具有依赖性检查的生成器

I've profiled my code and realised, that Zend_Loader::loadClass takes a lot of time (like 100ms of each request). I see the point - being run for every class it's no surprise.

We already use opcode caching, but I want more. What I want to do is to merge frequently used classes to one file and require that file in bootstrap - thus having all the classes ready for use, minimising IO operations to minimum - autoloader won't be even fired ;)

Problem: There is a lot of classes that are required practically on every request (front controller, router, dispatcher, inflectors, controller abstract, helper broker, etc). Those classes have dependencies - their interfaces or abstract classes. I thought I would be able to make an automated tool to check for those dependencies, that would allow me to insert the classes into the file in propper order. Unfortunately autoloader doesn't load them in required order, but rather "as they come" in parsed code (for Zend_Form_Element: Z_F_Element_Text, Z_F_Element_Xhtml, Z_F_Element, ...) so dumping the classname in autoloader is no-go :(

Question: Do you use / is there a tool that would help in my case? I'd be happy to implement it myself if I had any abstract idea of how to do it.

As of ZF2 automated tool exists. Thanks to EvanDotPro:

https://github.com/EvanDotPro/EdpSuperluminal

I also rough-ported it to ZF1 (please test first - may not be 100% working, but worked in my case):

https://github.com/tomasfejfar/ZF1-superluminal

The best answer I can give you is a post I read about this that REALLY got down and dirty with autoloading technique performance details.

http://weierophinney.net/matthew/archives/245-Autoloading-Benchmarks.html

You can at least improve performance for the classes loaded by the Zend_Loader_PluginLoader by using an "include file cache" - http://framework.zend.com/manual/en/zend.loader.pluginloader.html#zend.loader.pluginloader.performance

I suppose you could extend this style of caching to the Zend_Loader though I'm not sure if that will help or make matters worse.