Re: Speeding up program

From: Date: Mon, 29 Oct 2001 20:40:15 +0000
Subject: Re: Speeding up program
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-72770@lists.php.net to get a copy of this message
wrote some code.. <? function test($testid) { echo "called from $testid!<br>"; return 4; } echo "DOING THE FIRST TEST<BR>"; for ($i = 0; $i < test('first'); $i++) { //doStuff }; echo "<br>"; echo "DOING THE SECOND EMILE COMPACT BLAH TEST<BR>"; for ($i = 0; $i < ($num?$num:($num = test('second'))); $i++) { //doStuff }; //for ($i = 0; $i < ($num?$num:($num = mysql_num_rows($Results))); $i++) { //}; ?> tralalal good luck "David Robley" <huntsman@www.nisu.flinders.edu.au> schreef in bericht news:01091910452903.15278@www... > On Tue, 18 Sep 2001 20:56, Niklas Lampén wrote: > > How big difference does it make in speed in these: > > > > <? > > for ($i = 0; $i < mysql_num_rows($Results); $i++) { > > blah > > }; > > ?> > > > > or > > > > <? > > $n = mysql_num_rows($Results); > > for ($i = 0; $i < $n; $i++) { > > blah > > }; > > ?> > > > > So actually I'm asking how much more/less it takes time to do the > > comparing against mysql_num_rows() insted of comparing against a > > variable. > > > > > > Niklas > > Will deppend on the environment in which you are running it. to test it > on your environment, try running each say ten thousand times in a loop, > and use a timer like microtime to check how long it takes.\ > > Then you can let us all know the answer. > > -- > David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc > CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA > > Why can't we just spell it orderves?

« previous php.general (#72770) next »