Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created September 29, 2010 16:33
Show Gist options
  • Save rafaelss/603070 to your computer and use it in GitHub Desktop.
Save rafaelss/603070 to your computer and use it in GitHub Desktop.
console.log("hello world!");
print "hello world!"
<?php print "hello world!" ?>
print "hello world!"
puts "hello world!"
$ ./run.sh
node ===
hello world!
real 0m0.067s
user 0m0.042s
sys 0m0.020s
lua ====
hello world!
real 0m0.004s
user 0m0.001s
sys 0m0.002s
php ===
hello world!
real 0m0.059s
user 0m0.037s
sys 0m0.014s
perl ===
hello world!
real 0m0.013s
user 0m0.003s
sys 0m0.005s
ruby ===
hello world!
real 0m0.014s
user 0m0.007s
sys 0m0.005s
#!/usr/bin/env bash
echo "node ==="
time node hello_world.js
echo ""
echo "lua ===="
time lua hello_world.lua
echo ""
echo "php ==="
time php hello_world.php
echo ""
echo "perl ==="
time perl hello_world.pl
echo ""
echo "ruby ==="
time ruby hello_world.rb
echo ""
@x0bandeira
Copy link

Isn't this an unfair benchmark?
Node probably has much more bootstrapping operations than ruby... server infrastructure X pure interpreter?

@rafaelss
Copy link
Author

maybe so, I dont know. I am just trying to find a script language that run small scripts fast, so bootstrapping may be important.
I just added some more languages and it seems lua is the winner for now.

I like this kind of stuff, just for fun :)

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