Skip to content

Instantly share code, notes, and snippets.

@jfairbairn
Created April 2, 2011 23:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jfairbairn/900008 to your computer and use it in GitHub Desktop.
Save jfairbairn/900008 to your computer and use it in GitHub Desktop.
heffalump:~ james$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.1]
heffalump:~ james$ php -v
PHP 5.3.4 (cli) (built: Jan 17 2011 21:54:20)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
heffalump:~ james$ cat foo.rb
msg = "Hello world"
100000.times do
puts <<EOF
<html><body>#{msg}</body></html>
EOF
end
heffalump:~ james$ time ruby foo.rb >/dev/null
real 0m0.089s
user 0m0.082s
sys 0m0.003s
heffalump:~ james$ cat foo.php
<?php
$message = "Hello world";
for($i=0;$i<100000;$i++) {
?>
<html><body><?= message ?></body></html>
<?php } ?>
heffalump:~ james$ time php foo.php >/dev/null
real 0m0.272s
user 0m0.144s
sys 0m0.126s
@ckdake
Copy link

ckdake commented Apr 3, 2011

Try using foo-ng!

https://gist.github.com/900040

PHP handles itself a little better.

@afutseng
Copy link

afutseng commented Apr 3, 2011

Try using foo-ng2 :)
https://gist.github.com/900263

echo is better than print.

@cyril
Copy link

cyril commented Apr 3, 2011

PHP is really an elephant.

@cystbear
Copy link

cystbear commented Apr 4, 2011

What about real world application?

@xsultan
Copy link

xsultan commented Apr 5, 2011

@xsultan
Copy link

xsultan commented Apr 5, 2011

check this out, interesting subject ;)

https://gist.github.com/903369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment