Hi,
It seems that for PHP5 to simply call __autoload() requires a massive .0040
seconds. Considering that each hit takes at least 30 classes, that's already
a tenth of a second gone on simply calling __autoload()! Why is it so slow?
My implementation should be extremely fast:
$LOCATION_TABLE=array();$LOCATION_TABLE['stdlib_phpvars_env']='c:/inetpub/ww
wroot/transOutput/web app/stdlib/phpVars/Env.php';
//~50 more lines like this here
$LOCATION_TABLE['test_stringtest']='c:/inetpub/wwwroot/transOutput/web
app/test/StringTest.php';
function __autoload ($n) {
global $autotracker; /$n=strtolower($n);/
if ($autotracker==$n)die("Attempting to autoload $n again");
$autotracker=$n;
if(!empty($GLOBALS['LOCATION_TABLE'][$n]))include_once($GLOBALS['LOCATION_TA
BLE'][$n]);}
Xdebug output:
TRACE START [2004-05-02 21:40:16]
0.0373 0 -> test_test->test_test()
C:\Inetpub\wwwroot\transOutput\Web app\test\Test.php:55
0.0376 0 -> func_get_args()
C:\Inetpub\wwwroot\transOutput\Web app\test\Test.php:52
0.0377 0 -> test_test->initStatictest()
C:\Inetpub\wwwroot\transOutput\Web app\test\Test.php:52
0.0379 0 -> test_test->main()
C:\Inetpub\wwwroot\transOutput\Web app\test\Test.php:55
0.0382 0 -> __autoload()
C:\Inetpub\wwwroot\transOutput\Web app\test\Test.php:16
0.0417 0 ->
include_once(c:\Inetpub\wwwroot\transOutput\Web
app\persistent\PropertyCriteria.php) C:\Inetpub\wwwroot\transOutput\Web
app\typeCheck.php:81
0.0419 0 ->
persistent_propertycriteria->persistent_propertycriteria()
So it looks like calling include_once() only takes .0002 seconds but getting
there in __autoload takes a massive .0040 seconds! Is this correct behavior?
What can I do to speed it up?
Thanks.
David Chen