You also need to remember that these tests need to be run 100s of times and
then calculate the avg.  However, as we can assume there is really not going
to be a big difference between the two.  Its not like they are whole seconds
apart.


B i g D o g


----- Original Message -----
From: "Remy Dufour" <[EMAIL PROTECTED]>
To: "SP" <[EMAIL PROTECTED]>; "Kondwani Spike Mkandawire"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, June 27, 2002 11:34 AM
Subject: Re: [PHP] Re: PHP and OOP


> I've tested thecode and there is what i've got
> Proceduraltook 1.24408602715 seconds
> OOtook 1.24240803719 seconds
> Here is the code. Test it by yourself
> <?php    function getmicrotime(){        list($usec, $sec) = explode("
> ",microtime());        return ((float)$usec + (float)$sec);    }
function
> icount($vs) {        $var=0;        while($count < $vs) {
> $count++;        }    }    $time_start = getmicrotime();
icount(1000000);
> echo "Procedural<br> took ". (getmicrotime() - $time_start) ."
seconds<br>";
> class count {        function icount($vs) {            $var=0;
> while($count < $vs) {                $count++;            }        }    }
> $time_start = getmicrotime();    $icount = new count;
> $icount->icount(1000000);    echo "<br>OO<br> took ". (getmicrotime() -
> $time_start) ." seconds";?>
>
> > OO is slower then procedural.  You can test that out yourself or look at
> > this article where the guy did a very basic test.  Maybe they will fix
the
> > speed problem by the time php5 comes around.
> > http://www.phpbeginner.com/columns/demitrious/objects/8
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

Reply via email to