Pages

2/04/2014

Languages Benchmark on Printing Hello World

Just got a spare time to do some benchmarking on programming languages.
P.S. This is just for fun. So I ran this test only once. I don't really care about the accuracy.


Ranking:

  1. C
  2. Bash
  3. Perl
  4. Mono
  5. Node
  6. Java
  7. Python
  8. Ruby
Version used:
gcc 4.8.1
perl 5.14.2
mono 2.10.8.1
node.js 0.10.15
java 1.7.0_51
python 2.7.5
ruby 1.9.3

Source code

a.c
#include <stdio.h>
main(){
    printf("Hello World!\n");
    return 0;
}

a.java
class A{
    public static void main(String[] args){
        System.out.printf("Hello World!\n");
    }
}

a.py
print "Hello World!";

a.rb
printf "Hello World!\n"

a.js
console.log("Hello World!");

a.pl
printf "Hello World!\n"

a.cs
using System;
public class A{
    static public void Main(){
        Console.WriteLine("Hello World!");
    }
}

No comments:

Post a Comment