Never tested it so I tried it out for the fun of it.  I didn't use yours but
I used the other guy's code on separate pages and did it ten times.  I guess
I was wrong, I got around 2% difference.  Definitely not the 20% difference
that guy got in his.  He was probably using a older version.  Mine was on
4.1.1 so everyone should be switching to OO from the looks of it.

OO     Procedural
3.22   2.87
3.09   3.05
2.91   3.00
2.88   2.99
3.08   3.09
3.25   3.04
2.97   2.94
2.94   3.01
3.05   2.90
3.07   2.96

3.05   2.99 avg

-----Original Message-----
From: Remy Dufour [mailto:[EMAIL PROTECTED]]
Sent: June 27, 2002 1:34 PM
To: SP; Kondwani Spike Mkandawire; [EMAIL PROTECTED]
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