Re: Whacky increment/assignment logic with $foo++ vs ++$foo

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

 



On Tue, 6 Oct 2009 12:15:54 -0400, tedd.sperling@xxxxxxxxx (tedd) wrote:

>At 3:56 PM +0200 10/6/09, Andrea Giammarchi wrote:
>>  > Does these behaves exactly?
>>>  for($i=0; $i<10; ++$i)
>>>  for($i=0; $i<10; $i++)
>>
>>different benchmarks showed ++$i is usually faster than $i++
>
>"Faster" is a relative term that is becoming more meaningless each year.
>
>Considering that "speed" is increasing and "memory" prices are 
>dropping exponentially, both of those are becoming less and less 
>important in design considerations (my opinion).
>
>The speeds of the Crays of yesteryear we are now holding in our hands 
>as cell phones. The memory we are buying today is literally fractions 
>of a cent of the tens of thousands of dollars we spent some 20 years 
>ago.

My memory is a bit vague, but I think my first hard disk had 10 MB, and cost about $2000--
about $0.20 a kilobyte. Now you can buy a 1 TB hard disk for less than $100 -- less than
$0.10 a gigabyte.

>I venture to claim the time it took me to write this email (and for 
>you to read it) was longer than the total time saved between using 
>++$i vs $i++ for all the php scripts in the world over the remaining 
>life span of PHP.
>
>Interesting "food for thought", huh?

When I started computing I could get five runs a week if I used the little "local"
computer (with 32K of 24 bit words, and costing $500,000), or three runs a week if I used
the big computer in Canberra (which had four times as much memory and cost $2 million).


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux