Justtechjobs.com Find a programming school near you






Online Campus Both


php-developer-list | 2001122

[PHP-DEV] MOPS Benchmark From: Sebastian Bergmann (sebastian <email protected>)
Date: 12/31/01

  'lo there,

  given the recent benchmark discussion on this list and my stumbling
  over Parrot last night (that comes with MOPS benchmark scripts for a
  variety of scripting languages), I ran a quick test:

    Language | Elapsed time | MOPS
    ----------------------+--------------+-----
    Python | 88 seconds | 2.27
    Perl | 102 seconds | 1.96
    PHP (+ ZendOptimizer) | 142 seconds | 1.41
    PHP | 158 seconds | 1.27

  I'm quite surprised that much slower than Python and Perl :-(

  I used PHP 4.2.0-dev and the current Zend Optimizer, as well as
  the current versions of ActivePerl and ActivePython on an AMD Duron
  800 machine running Windows 2000.

  Here's the script I benchmarked PHP with:

    <?php
    set_time_limit(0);

    $i2 = 0; # set I2, 0
    $i3 = 1; # set I3, 1
    $i4 = 100000000; # set I4, 100000000
                                 #
    print "Iterations: $i4\n";# print "Iterations: "
                                 # print I4
                                 # print "\n"
                                 #
    $i1 = 2; # set I1, 2
    $i5 = $i4 * $i1; # mul I5, I4, I1
                                 #
    print "Estimated ops: $i5\n";# print "Estimated ops: "
                                 # print I5
                                 # print "\n"
                                 #
    $n1 = time(); # time N1
                                 #
    while ($i4 != 0) # REDO:
      $i4 = $i4 - $i3; # sub I4, I4, I3
                                 # if I4, REDO
                                 #
                                 # DONE:
    $n5 = time(); # time N5
                                 #
    $n2 = $n5 - $n1; # sub N2, N5, N1
                                 #
    print "Elapsed time: $n2\n";# print "Elapsed time: "
                                 # print N2
                                 # print "\n"
                                 #
    $n1 = $i5; # iton N1, I5
    $n1 = $n1 / $n2; # div N1, N1, N2
    $n2 = 1000000.0; # set N2, 1000000.0
    $n1 = $n1 / $n2; # div N1, N1, N2
                                 #
    print "M op/s: $n1\n";# print "M op/s: "
                                 # print N1
                                 # print "\n"
                                 #
                                 # end
    ?>

  The scripts used for Perl and Python can be found in the Parrot CVS.

-- 
  Sebastian Bergmann
  http://sebastian-bergmann.de/                 http://phpOpenTracker.de/

Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>