Hallo,
Es ging mir bei diesem Test um die Performance Unterschiede zwischen einem Array, welches schon direkt geparsed werden kann und einem, dass nach und nach geparsed wird.
Code
$ perl x.pl
$ php php_test.php
Total Duration of this page: 0.013956 microseconds
$ php php_test.php
Total Duration of this page: 0.013985 microseconds
$ php php_test.php
Total Duration of this page: 0.013941 microseconds
$ php php_test2.php
Total Duration of this page: 0.015512 microseconds
$ php php_test2.php
Total Duration of this page: 0.015499 microseconds
$ php php_test2.php
Total Duration of this page: 0.015411 microseconds
Alles anzeigen
PHP
// php_test.php
$x = array(
0.472157108538394 => array(0.524133517366892,5.08542027149092,8.20763620799351,5.24656835437439,9.52294293419961,12.9170996064341,7.55460798103403,12.3744660719387,13.1095285198637,5.5348173333431,),
13.3924968481025 => array(8.63032262351664,4.6835467080259,8.65474102546381,8.58802427552451,4.21407062401363,8.95581469229498,14.6748116831593,5.9306582644923,8.73534646335285,5.14790043772173,),
11.435684050043 => array(7.00288462309093,3.07451092645655,7.36857825509531,2.12388198731931,1.30345309124376,1.02804993624614,9.32451740591652,12.5792316943417,7.5079002194413,11.6356854653617,),
...
PHP
// php_test2.php
$x = array();
$x[0.128971962639426] = array(0.940037700535843,2.36889818027581,14.8107834400462,11.2597794733489,12.1010076692699,9.51976895945929,9.80510545264378,14.4657840302406,11.5886428216066,10.2418708148763,);
$x[2.43204657066519] = array(10.9921034573698,8.30249720069206,6.61182845020402,7.58144751320769,7.3104569046405,4.87952061138154,12.0066368697158,1.19457758718474,2.26479058716365,12.4573308339891,);
$x[1.31539739332535] = array(5.37091245497676,3.85752350292414,13.8014175386243,14.8095458642566,11.6341439671635,13.5737364987365,5.3170496419837,9.53835404566274,7.71411413606755,10.7146598843028,);
...
Der Test wurde mit einem 10000 zeiligen Array gestestet.