Re: Re: PHP and OOP
| From: | B i g D o g | Date: | Thu, 27 Jun 2002 17:47:47 +0000 |
| Subject: | Re: Re: PHP and OOP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104195@lists.php.net to get a copy of this message | ||
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" <rdufour@propage.com>
To: "SP" <internetracer@yifan.net>; "Kondwani Spike Mkandawire"
<kondwani@cs.mun.ca>; <php-general@lists.php.net>
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