Skip to content

Instantly share code, notes, and snippets.

@Domon
Forked from ckdake/gist:900040
Created April 3, 2011 14:00

Revisions

  1. @ckdake ckdake revised this gist Apr 3, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,7 @@ print <<<EOF
    <html><body>$message</body></html>
    EOF;
    }

    ruby-1.9.2-p0 adella:benchmarks$ time ruby foo.rb >/dev/null

    real 0m0.090s
  2. @ckdake ckdake revised this gist Apr 3, 2011. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,27 @@

    ruby-1.9.2-p0 adella:benchmarks$ ruby -v
    ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]

    ruby-1.9.2-p0 adella:benchmarks$ php -v
    PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

    ruby-1.9.2-p0 adella:benchmarks$ cat foo.rb
    msg = "Hello world"
    100000.times do
    puts <<EOF
    <html><body>#{msg}</body></html>
    EOF
    end

    ruby-1.9.2-p0 adella:benchmarks$ cat foo.php
    <?php
    $message = "Hello world";
    for($i=0;$i<100000;$i++) {
    ?>
    <html><body><?= message ?></body></html>
    <?php } ?>

    ruby-1.9.2-p0 adella:benchmarks$ cat foo-ng.php
    <?php
    $message = "Hello world";
  3. @ckdake ckdake created this gist Apr 3, 2011.
    44 changes: 44 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@

    ruby-1.9.2-p0 adella:benchmarks$ ruby -v
    ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
    ruby-1.9.2-p0 adella:benchmarks$ php -v
    PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    ruby-1.9.2-p0 adella:benchmarks$ cat foo.rb
    msg = "Hello world"
    100000.times do
    puts <<EOF
    <html><body>#{msg}</body></html>
    EOF
    end
    ruby-1.9.2-p0 adella:benchmarks$ cat foo.php
    <?php
    $message = "Hello world";
    for($i=0;$i<100000;$i++) {
    ?>
    <html><body><?= message ?></body></html>
    <?php } ?>
    ruby-1.9.2-p0 adella:benchmarks$ cat foo-ng.php
    <?php
    $message = "Hello world";
    for($i=0;$i<100000;$i++) {
    print <<<EOF
    <html><body>$message</body></html>
    EOF;
    }
    ruby-1.9.2-p0 adella:benchmarks$ time ruby foo.rb >/dev/null

    real 0m0.090s
    user 0m0.084s
    sys 0m0.005s
    ruby-1.9.2-p0 adella:benchmarks$ time php foo.php >/dev/null

    real 0m0.352s
    user 0m0.198s
    sys 0m0.150s
    ruby-1.9.2-p0 adella:benchmarks$ time php foo-ng.php >/dev/null

    real 0m0.132s
    user 0m0.073s
    sys 0m0.055s