![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
![]() Developer Grupa: Moderatorzy Postów: 2 844 Pomógł: 20 Dołączył: 25.11.2003 Skąd: Olkusz ![]() |
Wczoraj juz mi sie troche nudzilo i postanowilem przetestowac ktora z tych funkcji jest najlepsza do trzymania konfiguracji ( systemu, langa, ect ), testy byly przy uzyciu
ab.exe (1000 polaczen na localhost) Kod Apache version : Apache/1.3.33 (Win32) php version : 5.0.2 Testowalem serialize" title="Zobacz w manualu PHP" target="_manual() require_once" title="Zobacz w manualu PHP" target="_manual() parse_ini_file" title="Zobacz w manualu PHP" target="_manual() Rezultaty poszczegulnych testow wyszly tak: Kod ----------------------------P A R S E _ I N I _ F I L E----------------------- E:\>ab.exe -n 1000 http://localhost/test.php This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests Server Software: Apache/1.3.33 Server Hostname: localhost Server Port: 80 Document Path: /test.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 5.250000 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 221000 bytes HTML transferred: 0 bytes Requests per second: 190.48 [#/sec] (mean) Time per request: 5.250 [ms] (mean) Time per request: 5.250 [ms] (mean, across all concurrent requests) Transfer rate: 40.95 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 2.2 0 15 Processing: 0 4 7.2 0 46 Waiting: 0 4 7.1 0 46 Total: 0 4 7.4 0 46 Percentage of the requests served within a certain time (ms) 50% 0 66% 0 75% 15 80% 15 90% 15 95% 15 98% 15 99% 15 100% 46 (longest request) Kod ----------------------R E Q U I R E _ O N C E-------------------------- E:\>ab.exe -n 1000 http://localhost/test.php This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests Server Software: Apache/1.3.33 Server Hostname: localhost Server Port: 80 Document Path: /test.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 4.734375 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 221000 bytes HTML transferred: 0 bytes Requests per second: 211.22 [#/sec] (mean) Time per request: 4.734 [ms] (mean) Time per request: 4.734 [ms] (mean, across all concurrent requests) Transfer rate: 45.41 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.8 0 15 Processing: 0 4 6.8 0 15 Waiting: 0 4 6.7 0 15 Total: 0 4 6.9 0 15 Percentage of the requests served within a certain time (ms) 50% 0 66% 0 75% 15 80% 15 90% 15 95% 15 98% 15 99% 15 100% 15 (longest request) Kod -------------------------------S E R I A L I Z E----------------------- E:\>ab.exe -n 1000 http://localhost/test.php This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Finished 1000 requests Server Software: Apache/1.3.33 Server Hostname: localhost Server Port: 80 Document Path: /test.php Document Length: 0 bytes Concurrency Level: 1 Time taken for tests: 4.218750 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 221000 bytes HTML transferred: 0 bytes Requests per second: 237.04 [#/sec] (mean) Time per request: 4.219 [ms] (mean) Time per request: 4.219 [ms] (mean, across all concurrent requests) Transfer rate: 50.96 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.9 0 15 Processing: 0 3 6.5 0 15 Waiting: 0 3 6.4 0 15 Total: 0 3 6.7 0 15 Percentage of the requests served within a certain time (ms) 50% 0 66% 0 75% 15 80% 15 90% 15 95% 15 98% 15 99% 15 100% 15 (longest request) Dane byly trzymane nastepujaco
Kod Parse_ini_file ............. Time per request: 5.250 [ms] (mean) Require_once ............... Time per request: 4.734 [ms] (mean) Serialize .................. Time per request: 4.219 [ms] (mean) Parse_ini_file ............. $array = parse_ini_file( './file.ini.php' ); Require_once ............... Require_once( './file.php' ); Serialize .................. $array = unserialize( file_get_contents( './test.ser' ) ); Znioski najlepiej trzymac dane jezeli chodzi o szybkosc w zalanczanym pliku (require_once) a jeszcze lepiej jak on jest zserializowany (wieksza szybkosc od zalanczania i parsowania pliku ini). Jezeli chodzi o wygode trzymania danych to wchyba wygrywa plik.ini (latwiejsza edycja i nie trzeba sie znac na php) jest troszke wolniejszy (mozna go do serialize wrzucic i szybkosc bedzie taka jak serialize ). Jeszcze z funckji zalanczajacych wyszlo mi ze najszybsza jest (minimalnie) require_once" title="Zobacz w manualu PHP" target="_manual() Wrzucilem to tutaj bo moze sie komus przyda |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 19.07.2025 - 12:52 |