Re: Question concerning performance

From: Date: Wed, 17 Jan 2001 15:55:09 +0000
Subject: Re: Question concerning performance
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35056@lists.php.net to get a copy of this message
> Example ONE: (in just parse mode) > --------[cut]--------------- > <? > print "<html-tag>blah blah blah blah blah blah blah</html-tag>"; > print "<html-tag>" . $Var1 . "</html-tag><b-tag>" . $Var2 > . "</b-tag>"; > ?> > --------[/cut]-------------- Ran a pretty rough benchmark: 10040 lines of code (5020 repetitions of the above example) 10 times with an average execution time of 6.07904628515244 seconds. > Example TWO: (in html && parse mode) > --------[cut]--------------- > <html-tag>blah blah blah blah blah blah blah</html-tag> > <html-tag><?=$Var1;?></html-tag><b-tag><?=$Var2;?></b-tag> > --------[/cut]-------------- Same benchmark, except these two lines were used instead of the two lines in the above case (obviously). Again, 10 executions; this time the average execution time was 6.40339350700379 seconds. There are 100 ways error could've been introduced into this test; even so, the results seem to lean towards not switching between html & php modes... although, you're talking about 1000 lines of code, and the test used 10 times that, and the resulting difference was a little more than 3 tenths of a second... if you compared it with 1/10th of the code (your 1000 line file), you'd probably have a difference in the hundredths-of-a-second range. It's up to you, but I agree with what Christian said - I'd probably shoot for being able to maintain the code; with such a little speed difference you might as well set up more servers than optimize for 1/5th of a second in execution time. --Toby

« previous php.general (#35056) next »