Some results with php3,php4 and a perl cgi

From: Date: Tue, 27 Jul 1999 05:28:11 +0000
Subject: Some results with php3,php4 and a perl cgi
Groups: php.version4 
Request: Send a blank email to php-version4+get-2831@lists.php.net to get a copy of this message
System : Redhat Linux 6.0/PII-400/128MB Hi, I wrote a simple php script to get over 56,000 rows from a Mysql database and just increment a counter and print it Here is the script <?php $i = 0 ; $linkid= mysql_pconnect($host,$user,$password); $result = mysql_db_query("databasename","select column from table"); while($row = mysql_fetch_row($result)) { echo $row[0] ; $i++ ; } mysql_free_result($result); mysql_close($linkid); echo "Number is $i" ; ?> I also wrote a corresponding Perl CGI script #!/usr/bin/perl use DBI ; use CGI ; my $q = new CGI ; print $q->header ; my $conn = DBI->connect("DBI:mysql:database:host:port", $user,$pass"); my $sql = qq{ select column from table }; $sth= $conn->prepare($sql); $sth->execute; my $row ; my $i = 0 ; while ($row = $sth->fetchrow_arrayref) { print @$row[0]; $i++ ; } print "Number is $i\n" ; $conn->disconnect; I compiled PHP3 and PHP4 (out of cvs today) via the following command line ./configure --with-apache=../apache_1.3.6 --with-mysql --disable-debug --enable-track-vars --enable-magic-quotes though I still see -g in CFLAGS for both PHP3 and PHP4 (Shouldn't disable-debug remove it ?) I ran the scripts via wget PHP3 time -p wget http://localhost:8000/database.phtml -o /dev/null real 3.13 user 0.01 sys 0.01 PHP4 time -p wget http://localhost:9000/database.phtml -o /dev/null real 1.41 user 0.02 sys 0.02 Perl time -p wget http://localhost:7000/cgi-bin/database.cgi -o /dev/null real 1.71 user 0.00 sys 0.01 Somehow, I believe PHP4 can be faster though my Perl CGI script seems to run quite fast. Anyway, more data points for the gurus to look at Cheers, Yusuf -- Yusuf Goolamabbas yusufg@outblaze.com

« previous php.version4 (#2831) next »