Web Server processing question

From: Date: Wed, 23 May 2001 14:06:05 +0000
Subject: Web Server processing question
Groups: php.general 
Request: Send a blank email to php-general+get-54058@lists.php.net to get a copy of this message
Hi all, I've been running some time trials on some of my PHP functions for a site I've been putting together, and noticed that the process time is SOMETIMES extremely high. Before I continue, let me say that I know that the times can be affected by other things running on the server, but the results are always the same no matter how many times I run it. In the following example, which is the one that I'm concerned about, the same function is called multiple times in a row (with nothing happening in between calls) for different "categories". Basically, the function sorts an array and outputs the 10 elements with the highest value. I ran the test several times, calling the function hundreds of times with the same data, and each time I ran the test every second call took thousands of times longer than the ones that ran ok. The results of the benchmark test (first 100): function SimpleList => 10.228178024292 seconds MAX, 0.0024620294570923 seconds MIN SimpleList item 1 took 0.0047399997711182 seconds SimpleList item 2 took 4.8834660053253 seconds SimpleList item 3 took 0.0026209354400635 seconds SimpleList item 4 took 1.6767669916153 seconds SimpleList item 5 took 0.0025150775909424 seconds SimpleList item 6 took 3.5071390867233 seconds SimpleList item 7 took 0.0066210031509399 seconds SimpleList item 8 took 1.8121999502182 seconds SimpleList item 9 took 0.0025880336761475 seconds SimpleList item 10 took 10.228178024292 seconds SimpleList item 11 took 0.0026429891586304 seconds SimpleList item 12 took 1.3569248914719 seconds SimpleList item 13 took 0.0026519298553467 seconds SimpleList item 14 took 1.5246760845184 seconds SimpleList item 15 took 0.047821998596191 seconds SimpleList item 16 took 2.1210349798203 seconds SimpleList item 17 took 0.0025339126586914 seconds SimpleList item 18 took 2.7077790498734 seconds SimpleList item 19 took 0.0024960041046143 seconds SimpleList item 20 took 1.8957049846649 seconds SimpleList item 21 took 0.0056090354919434 seconds SimpleList item 22 took 1.3942409753799 seconds SimpleList item 23 took 0.0032639503479004 seconds SimpleList item 24 took 2.5071721076965 seconds SimpleList item 25 took 0.0025739669799805 seconds SimpleList item 26 took 0.75933194160461 seconds SimpleList item 27 took 0.0025299787521362 seconds SimpleList item 28 took 1.3230199813843 seconds SimpleList item 29 took 0.0025479793548584 seconds SimpleList item 30 took 1.5940990447998 seconds SimpleList item 31 took 0.002769947052002 seconds SimpleList item 32 took 1.6990089416504 seconds SimpleList item 33 took 0.0025010108947754 seconds SimpleList item 34 took 1.4948740005493 seconds SimpleList item 35 took 0.0025290250778198 seconds SimpleList item 36 took 1.3077820539474 seconds SimpleList item 37 took 0.0027199983596802 seconds SimpleList item 38 took 2.3882880210876 seconds SimpleList item 39 took 0.023046970367432 seconds SimpleList item 40 took 0.88547909259796 seconds SimpleList item 41 took 0.0026249885559082 seconds SimpleList item 42 took 1.494973897934 seconds SimpleList item 43 took 0.0025370121002197 seconds SimpleList item 44 took 1.4878768920898 seconds SimpleList item 45 took 0.0028669834136963 seconds SimpleList item 46 took 1.6947749853134 seconds SimpleList item 47 took 0.0025030374526978 seconds SimpleList item 48 took 1.3992600440979 seconds SimpleList item 49 took 0.0062370300292969 seconds SimpleList item 50 took 2.4599330425262 seconds SimpleList item 51 took 0.0027350187301636 seconds SimpleList item 52 took 0.73624801635742 seconds SimpleList item 53 took 0.0050810575485229 seconds SimpleList item 54 took 2.2535430192947 seconds SimpleList item 55 took 0.0036349296569824 seconds SimpleList item 56 took 1.6462769508362 seconds SimpleList item 57 took 0.0025260448455811 seconds SimpleList item 58 took 3.1076270341873 seconds SimpleList item 59 took 0.0027920007705688 seconds SimpleList item 60 took 1.5962820053101 seconds SimpleList item 61 took 0.0025190114974976 seconds SimpleList item 62 took 1.6848870515823 seconds SimpleList item 63 took 0.0025689601898193 seconds SimpleList item 64 took 2.0958459377289 seconds SimpleList item 65 took 0.0026199817657471 seconds SimpleList item 66 took 2.2060899734497 seconds SimpleList item 67 took 0.0070620775222778 seconds SimpleList item 68 took 2.1034359931946 seconds SimpleList item 69 took 0.0029339790344238 seconds SimpleList item 70 took 2.2868009805679 seconds SimpleList item 71 took 0.0025150775909424 seconds SimpleList item 72 took 2.9152449369431 seconds SimpleList item 73 took 0.0030900239944458 seconds SimpleList item 74 took 2.9968670606613 seconds SimpleList item 75 took 0.0028420686721802 seconds SimpleList item 76 took 3.005833029747 seconds SimpleList item 77 took 0.0052200555801392 seconds SimpleList item 78 took 1.4939750432968 seconds SimpleList item 79 took 0.0025509595870972 seconds SimpleList item 80 took 3.2771420478821 seconds SimpleList item 81 took 0.0027899742126465 seconds SimpleList item 82 took 3.0382519960403 seconds SimpleList item 83 took 0.0025210380554199 seconds SimpleList item 84 took 1.7047400474548 seconds SimpleList item 85 took 0.00279700756073 seconds SimpleList item 86 took 1.4964989423752 seconds SimpleList item 87 took 0.0025299787521362 seconds SimpleList item 88 took 1.6868020296097 seconds SimpleList item 89 took 0.0025640726089478 seconds SimpleList item 90 took 1.4976640939713 seconds SimpleList item 91 took 0.0025249719619751 seconds SimpleList item 92 took 1.4759020805359 seconds SimpleList item 93 took 0.0032650232315063 seconds SimpleList item 94 took 1.5173159837723 seconds SimpleList item 95 took 0.0043590068817139 seconds SimpleList item 96 took 8.8674029111862 seconds SimpleList item 97 took 0.0025320053100586 seconds SimpleList item 98 took 0.9132479429245 seconds SimpleList item 99 took 0.0026270151138306 seconds SimpleList item 100 took 1.6772450208664 seconds Can anyone explain to me why every second call runs so slow? It's obviously not the data, and seemingly not the PHP code (as the same chunk of code is being used each time, with the same input/output). Thanks, RockMonkey

« previous php.general (#54058) next »