ID:               22308
 Updated by:       [EMAIL PROTECTED]
 Reported By:      uk at dataway dot ch
-Status:           Open
+Status:           Closed
 Bug Type:         Performance problem
 Operating System: Linux 2.2.18
 PHP Version:      4.3.0
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2003-02-19 16:55:40] uk at dataway dot ch

Using passthru("whatever") is almost 100 times slower than doing the
equivalent $out = `whatever`;echo $out

I tested this using the following program (I use dd here to generate
the data, but the same results appear with any command, cat /etc/passwd
etc.)

<?php
        echo "<!--";
        $start = microtime();
        passthru("dd if=/dev/zero count=100");
        $end = microtime();
        echo "-->";

        $mt = explode(' ', $start);
        $mts = $mt[1] + $mt[0];
        $mt = explode(' ', $end);
        $mte = $mt[1] + $mt[0];
        printf("%.3f seconds elapsed (passthru)<p>", $mte - $mts);

        echo "<!--";
        $start = microtime();
        $out = `dd if=/dev/zero count=100`;
        echo $out;
        $end = microtime();
        echo "-->";

        $mt = explode(' ', $start);
        $mts = $mt[1] + $mt[0];
        $mt = explode(' ', $end);
        $mte = $mt[1] + $mt[0];
        printf("%.3f seconds elapsed (backquotes)<p>", $mte - $mts);
?>

On my machine (Pentium 400) this script outputs:

16.231 seconds elapsed (passthru)
0.266 seconds elapsed (backquotes)

Quite a difference, I think.

Compiled with:

./configure \
        --bindir=/usr/local/apache/bin \
        --libdir=/usr/local/apache/php/lib \
        --with-apxs=/usr/local/apache/bin/apxs \
        --with-config-file-path=/usr/local/apache/conf \
        --with-exec-dir=/usr/local/apache/php/bin \
        --with-pear=/usr/local/apache/php/lib \
        --enable-safe-mode \
        --with-openssl=/usr/local/ssl \
        --with-imap=shared,/usr/local \
        --enable-dbx=shared \
        --enable-dio=shared \
        --enable-ftp \
        --with-sybase-ct=shared,/usr/local \
        --with-mysql=shared,/usr/local/mysql \
        --with-pgsql=shared,/usr/local/pgsql \
        --with-gdbm=shared \
        --with-zlib=/usr/local \
        --with-gd=shared \
        --enable-exif=shared \
        --enable-ctype \
        --with-gettext \
        --with-xml=shared \
        --with-expat-dir=/usr/local \
        --enable-xslt=shared \
        --with-xslt-sablot=/usr/local \
        --enable-sockets=shared \
        --enable-wddx=shared \
        --enable-shmop=shared \
        --enable-sysvmsg=shared \
        --enable-sysvsem=shared \
        --enable-sysvshm=shared


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22308&edit=1

Reply via email to