Re: [PHP] multiply by 2

2002-05-20 Thread Jason Wong
On Monday 20 May 2002 12:03, Martin Towell wrote: I was doing some timing of a function on the weekend and in one of the loops, I had to multiply a variable by 2 - easy enough - $i*2 but then I remembered that in C, it's quicker to do a left shift - so $i1 but this actually took longer to

Re: [PHP] multiply by 2

2002-05-20 Thread Bogdan Stancescu
Just for confirmation: Linux Mandrake 8.1, PHP 4.0.6, PIII 600MHz, using Jason's code: - Original code via HTTP: 1st attempt 3.4497429132462 3.1789749860764 [7.85% faster with bit op's] 2nd attempt (reload) 3.3336659669876 3.1573359966278 [5.29% faster with bit op's] - Original code from the

[PHP] multiply by 2

2002-05-19 Thread Martin Towell
I was doing some timing of a function on the weekend and in one of the loops, I had to multiply a variable by 2 - easy enough - $i*2 but then I remembered that in C, it's quicker to do a left shift - so $i1 but this actually took longer to execute in php than the $i*2 - can anyone confirm my