phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-developers] PHP3 Compatiability and Performance


From: Dave Hall
Subject: [Phpgroupware-developers] PHP3 Compatiability and Performance
Date: Mon, 14 Jul 2003 18:53:27 +1000

Hi again,

I just realised that I forgot to mention in my previous posts that they
are for 16/HEAD.

This is a bit of a "Egg Sucking 101" - but might be useful for some of you.

Anyway, on to the next issue.  As you should be aware are dropping php3
support in 16+ (in favour of 4.1.0+).  This should allow us to improve
performance a bit.

While looking into performance issues, I came across this:
http://www.php.lt/benchmark/phpbench.php

As you will see using foreach() loops instead of while(list() = each())
is a lot faster.  You also don't need to reset() the array.

The same is true for finding the size of the array before using count()
in the for() statement - as it is recalculated on each iteration.

You might think ok, a few miliseconds is not much, but they all add up.

Another one to keep in mind (something I have done a lot of :( ), is
testing vars.  is_array() can add a lot of overhead, but imho it has its
place, but should be combined with is_empty().  if(!empty($array) &&
is_array($array))

There are quite a lot of php3 version checks used.  This is also not
needed now.  A little more time savings :)

I think everyone working in cvs should be making these changes as they
find them.  Those of you who do have cvs access - post some patches :) 
Please do fix these in 14 - it should be php3 compatiable.

Cheers

Dave

Attachment: dave.hall.vcf
Description: Card for <dave.hall@mbox.com.au>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]