On Wed, Aug 12, 2009 at 12:07 PM, tedd <tedd.sperling@xxxxxxxxx> wrote: > At 9:50 AM -0500 8/12/09, Shawn McKenzie wrote: > >> tedd wrote: >> >>> >>> Your solution had 61 iterations (for loop) while mind had only 21, so >>> mine's a bit faster. Here's the comparison: >>> >>> http://php1.net/b/fridays/ >>> >>> But I'll use your solution -- it's more elegant. >>> >>> Thanks for the code, >>> >>> tedd >>> >>> >> Actually, if you refresh your page you have different winners. When I >> first visited the page yours was fastest by approximately .001, but on >> refresh yours is slower by .001. You need to execute the test let's say >> 100 or 1000 times or more (more is better) and take either the average >> or I would say the minimum. >> >> -- >> Thanks! >> > > > But of course -- no one try is definitive, you need many. > > For example, I wrote a script to show that PHP's rounding function had an > upward bias, which it does, but it took thousands of iterations to see it. > Not worth the effort to correct. > > In any event, it's interesting to see how we all approached the problem > from different directions. > > Cheers, > > tedd > > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Well, this was a nice experiment. What do we must learn about this? performance < legibility Stuart solutions look that's the faster, but in the other hand Shawn's solution 2 looks the most legible (so far). -- Martin Scotta