Guest Posted December 14, 2008 Share Posted December 14, 2008 So I've read that autoloading classes negates the benefits of opcode caching solutions (like APC, because the importing is done in runtime) -- but what I couldn't figure out is, to what degree? If I were to rely entirely on autoloading (all classes and their internal dependencies), I assume caching solutions will be completely useless. But what if I were to manually require/include their dependencies, and only have the main classes themselves autoloaded; would the dependencies be cached? Or perhaps there are ways around this? I'm right now looking into the SPL autoloader. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted December 14, 2008 Share Posted December 14, 2008 I don't know where you've been reading this, but autoloading and opcode cacheing aren't related in that way. Opcode cacheing simply means that the PHP files that you load are compiled into cache, so the next time you load them (whether using include, require, autoload, or whatever) they are already complied in the cache. include, require and autoload simply tell php what files it needs to compile Quote Link to comment Share on other sites More sharing options...
Guest Posted December 14, 2008 Share Posted December 14, 2008 Here are two sources off the top of my head, them and their comments infer that, although in theory you're right, in execution, it doesn't seem to be the case. http://pooteeweet.org/blog/538/ http://sb2.info/alternative-php-cache-and-autoload-interoperability/ Any thoughts? Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted December 14, 2008 Share Posted December 14, 2008 Well reading those two articles, any issues don't seem to relate directly to autoload and apc: you still get the majority of the bytecode cache benefit which is that you don’t need to re-read the file, do lexical analysis and run a parser on it the code…and To clarify, of course conditionally included files get compiled and cached. The issue is not the included files It all seems to revolve around conditionally defined classes and functions. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 14, 2008 Share Posted December 14, 2008 8ball, just have to say I absolutely love this, "Killing one bird with fourteen stones" Quote Link to comment Share on other sites More sharing options...
Guest Posted December 14, 2008 Share Posted December 14, 2008 Oh! Looking back, that makes complete sense. I must have completely misread those quotes; silly of me. My bad and sorry for wasting your time! And thanks! @Yesideez hehe Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.