[TYPO3-project-4-3] autoloader using SPL

Dmitry Dulepov [typo3] dmitry at typo3.org
Mon Aug 4 10:26:03 CEST 2008


Hi!

Ingo Renner wrote:
> The problem with TYPO3 and its extensions is that we do not have a 
> "default" filesytem structure how/where classes are located and how 
> their files are named.

We actually have to certain degree...

<skip>

> However I think that we can also come up with autoloading for classes 
> located in extensions that do not follow a certain schema or structure 
> of placing classes in certain folders. (We should establish that though)
> 
> The idea I had is to recursivly run through all directories and see 
> which classes are in which files. Collect this information in a kind of 
> key => value "registry"/array. This collected information should then of 
> course be stored somewhere (using the new caching framework maybe?!).

t3lib_ and tslib_ do not need this. So it is tx_ and files in typo3/.

> All in all I think that having autoloading in 4.3 is _a must_. When 
> doing some profiling using xdebug + kcachegrind I found that one aspect 
> that slows TYPO3 down a lot are the many many includes we do as each 
> include means a hard disk read access - and we all know that HDDs are slow.

Firsts, does require_once is the problem too?

Secondly, you do not need HDD if you have a real server with enough memory, OS cache and eAccelerator with proper shared memory settings. This should be a default configuration. I am not talking of course about shared hosting.

Thirdly, I am not sure that looking up the registry and including the file is faster than just including the file with require_once. On the other hand many TYPO3 files always include files but use them only in some cases. Here autoload can be a good alternative. But I still doubt we should blindly go and remove all require_once in favor of autoload. Blind actions never do anything good.

Additionally, the question: will autoloaded classes be cacheable with PHP accelerators? I am asking because there are *rumors* that they are not cached. eAccelerator improves speed by more than 10 times and I do not want to loose that.

-- 
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/post-details/typo3_code_formatting_in_eclipse/


More information about the TYPO3-project-4-3 mailing list