Re: Associative Arrays Performance under Linux

From: Date: Sat, 10 Nov 2001 05:28:06 +0000
Subject: Re: Associative Arrays Performance under Linux
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74080@lists.php.net to get a copy of this message
This is just a suggestion. Rather than creating the associative array from scratch, prebuild one and just use copies of that associative array when you need it. I don't know whether it will be faster, but intutitively it should. This is analogous to pre-allocating structs in memory before using them in C. Regards, John PS: Let me know if this is practical and if it works! Mike Boulet <mike@newfangled.com> wrote in message news:20011109144131.24929.qmail@pb1.pair.com... > I have been troubleshooting the performance of some code for a couple of > days and I have not been able to find out what is happening. > > Here's the pseudo-code > > - Get jobs from the MySql database. Return all customers. Returns 10 rows. > then for each customer return their active jobs. ( About 1 to 2 rows ). > - for each row build and array entry which looks like the following > > Array Customers > { > Array CustInfo() > { > Array Job 1 Info > Array Functions() > Array Details() > Array Job 2 Info > Array Functions() > Array Details() > } > Array CustInfo() > { > Array Job 1 Info > Array Functions() > Array Details() > Array Job 2 Info > Array Functions() > Array Details() > } > } > > There may be more than one customer (CustInfo) stored. The problem is > that under Windows 2000 server the code that builds the array takes 1/1000 > of second to execute for each item added to the custinfo array. When I move > the same code and database to my Red Hat 7.1 Linux server it takes 2/100 of > a second!! So the whole process of building the arrays takes a total of > 2/10th of a second under Windows 2000 server and takes 2 seconds on the > Linux server. > I have never seen this kind of issue before under Linux and was wondering > what it could be? PHP Config option? Linux config option? > > Specs of the Servers > ================================= > The Windows 2000 server is a 600Mhz Pentium with 384Megs ram > > The Linux server is Red Hat 7.1 on a Dual gighz server with 512 megs ram.. > > Both servers are running php 4.0.6. > > There is no load on the Linux server to affect the numbers. All other > processes including other PHP code runs great and much faster than Windows > 2000. > > Any advice would be appreciated. > > > >

« previous php.general (#74080) next »