Re: [PHP] array speed

2001-04-05 Thread Yasuo Ohgaki

Just make sure you use foreach() instead of while() when you loop many times.

foreach() is roughly 50% faster when I benched them.

And never pass type other than object or array. foreach() simply dose not work
with error message. (i.e. You will get 'server not found or dns error' or empty
output)

Regards,
--
Yasuo Ohgaki


"Kurth Bemis" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i'm concerned about the speed at which httpd (with php4.0.1pl1 compiles in
> as a static mod) can "chew" through a 350 element 2d array.  Can anyone
> offer any information?
>
> ~kurth
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array speed

2001-04-05 Thread Joe Stump

let me be more clear about the microtime() - do something like:



--Joe

On Thu, Apr 05, 2001 at 02:43:40PM -0500, Joe Stump wrote:
> You can do some test with microtime() and see how long it takes. 350 elements
> isn't really a large array. I've seen PHP chew through arrays of 250k plus in
> only a second or so. It will take longer for 350 elements to be shoved out to
> the output buffer than it would to actually loop through it. 
> 
> --Joe
> 
> On Thu, Apr 05, 2001 at 10:41:10PM +0300, Rouvas Stathis wrote:
> > I wouldn't worry about that. Although it all depends by what do you mean
> > by "speed":-)
> > Anyway, you can always test your page with "ab" (part of the Apache
> > installation, at least on Linux)
> > -Stathis.
> > 
> > Kurth Bemis wrote:
> > > 
> > > i'm concerned about the speed at which httpd (with php4.0.1pl1 compiles in
> > > as a static mod) can "chew" through a 350 element 2d array.  Can anyone
> > > offer any information?
> > > 
> > > ~kurth
> > > 
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> /**\
>  *Joe Stump - PHP/SQL/HTML Developer  *
>  * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
>  * "Better to double your money on mediocrity than lose it all on a dream."   * 
> \**/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


/**\
 *Joe Stump - PHP/SQL/HTML Developer  *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\**/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array speed

2001-04-05 Thread Joe Stump

You can do some test with microtime() and see how long it takes. 350 elements
isn't really a large array. I've seen PHP chew through arrays of 250k plus in
only a second or so. It will take longer for 350 elements to be shoved out to
the output buffer than it would to actually loop through it. 

--Joe

On Thu, Apr 05, 2001 at 10:41:10PM +0300, Rouvas Stathis wrote:
> I wouldn't worry about that. Although it all depends by what do you mean
> by "speed":-)
> Anyway, you can always test your page with "ab" (part of the Apache
> installation, at least on Linux)
> -Stathis.
> 
> Kurth Bemis wrote:
> > 
> > i'm concerned about the speed at which httpd (with php4.0.1pl1 compiles in
> > as a static mod) can "chew" through a 350 element 2d array.  Can anyone
> > offer any information?
> > 
> > ~kurth
> > 
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


/**\
 *Joe Stump - PHP/SQL/HTML Developer  *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\**/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] array speed

2001-04-05 Thread Rouvas Stathis

I wouldn't worry about that. Although it all depends by what do you mean
by "speed":-)
Anyway, you can always test your page with "ab" (part of the Apache
installation, at least on Linux)
-Stathis.

Kurth Bemis wrote:
> 
> i'm concerned about the speed at which httpd (with php4.0.1pl1 compiles in
> as a static mod) can "chew" through a 350 element 2d array.  Can anyone
> offer any information?
> 
> ~kurth
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] array speed

2001-04-05 Thread Kurth Bemis

i'm concerned about the speed at which httpd (with php4.0.1pl1 compiles in 
as a static mod) can "chew" through a 350 element 2d array.  Can anyone 
offer any information?

~kurth


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]