[TYPO3-project-4-3] autoloader using SPL
Ingo Renner
ingo at typo3.org
Mon Aug 4 11:48:48 CEST 2008
Dmitry Dulepov [typo3] wrote:
> 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/.
Well, they do need this too, there are a few exceptions like
t3lib_basicFileFunctions is in class.t3lib_basicfilefunc.php instead of
class.t3lib_basicfilefunctions.php
>> 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.
You'll always need or some kind of slow but large memory storage.
> Thirdly, I am not sure that looking up the registry and including the
> file is faster than just including the file with require_once.
The problem is that, require_once itself is slow already as it does a
HDD read access even if the file/class is loaded already - can't
remember though where I read that.
> On the
> other hand many TYPO3 files always include files but use them only in
> some cases.
That's exactly the problem.
> 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.
This is not a blinf action as I described how I think it
should/would/would work. In the worst case it's just as slow/fast as the
current way of including all files. In all other cases it's most
likely going to be faster.
> 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.
I'm not sure, but I guess so, why shouldn't they? It's still an actual
include/require that happens.
Ingo
--
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2
More information about the TYPO3-project-4-3
mailing list