Welcome Guest, Not a member yet? Register   Sign In
php mod % 3
#9

[eluser]John_Betong[/eluser]
Hi Pygon,

Many thanks for your code I learnt how easy it was to use the BenchMark Class, This will no doubt come in handy in the future.

I would not have imagined Modulos to be much faster and think it was the repeated if test to see if $i==0 was the time grabber.

Empty() just tests for Null, 0 or an empty string whereas strnlen() should test and cater for string lengths, etc. Maybe also allocate memory for the counter.

A long time ago I read why $i++ is faster than $i+=1 and think the reason is something to do with just shifting a bit in the byte whereas the +1 must use the addition routine. I have just remembered the good old days and having to write a multiplication routine using Z80 Assembler - no mean task!

Aren't computers fun Smile

Cheers,

John_Betong
 


Messages In This Thread
php mod % 3 - by El Forum - 10-18-2007, 06:07 PM
php mod % 3 - by El Forum - 10-18-2007, 08:01 PM
php mod % 3 - by El Forum - 10-18-2007, 10:00 PM
php mod % 3 - by El Forum - 10-18-2007, 10:07 PM
php mod % 3 - by El Forum - 10-19-2007, 03:31 AM
php mod % 3 - by El Forum - 10-29-2007, 04:04 PM
php mod % 3 - by El Forum - 10-31-2007, 05:24 AM
php mod % 3 - by El Forum - 10-31-2007, 08:23 AM
php mod % 3 - by El Forum - 10-31-2007, 09:03 AM
php mod % 3 - by El Forum - 10-09-2008, 04:07 PM
php mod % 3 - by El Forum - 10-09-2008, 09:06 PM
php mod % 3 - by El Forum - 10-09-2008, 11:17 PM
php mod % 3 - by El Forum - 10-10-2008, 12:34 AM
php mod % 3 - by El Forum - 10-10-2008, 03:38 AM
php mod % 3 - by El Forum - 10-10-2008, 12:23 PM
php mod % 3 - by El Forum - 10-11-2008, 09:36 AM
php mod % 3 - by El Forum - 10-11-2008, 01:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB