Google’s “go” simple & stupid benchmark (1st round: I/O)

Systems programming language? They gotta be kiddin…

$ cat hello.cpp && g++ hello.cpp &&
> time for i in $(seq 100); do ./a.out >/dev/null; done

#include <stdio.h>
int main (int argc, char** argv)
{
    for (int i=10000;i--;)
    {
        printf("hello, world\n");
    }
}

real 0m0.427s
user 0m0.220s
sys 0m0.164s

$ cat hello.py &&
> time for i in $(seq 100); do python hello.py >/dev/null; done

for i in range(1,10001):
    print "hello, world"

real 0m3.809s
user 0m2.800s
sys 0m0.724s

$ cat hello.go && 8g hello.go && 8l hello.8 &&
> time for i in $(seq 100); do ./8.out >/dev/null; done

package main
import "fmt"
func main()
{
    for i:=10000;i>0;i--
    {
        fmt.Printf("hello, world\n")
    }
}

real 0m7.528s
user 0m6.388s
sys 0m0.664s

Continued in Round 2: memspeed

Tags: , [en, es] | November 11th, 2009 |

6 Responses to “Google’s “go” simple & stupid benchmark (1st round: I/O)”

  1. juanval Says:

    warf! 7 seconds?? Holy crap!
    But maybe testing for I/O is not the best benchmark

    Could you try something like more CPU/memory intensive like this and see how much it takes in go? In C++, in my computer it takes about 13 seconds

    int main()
    {
    const int BUFSIZE = 1500;
    int in1[BUFSIZE];
    int in2[BUFSIZE];
    int out[BUFSIZE];

    for(int i=0;i<BUFSIZE;++i)
    for(int j=0;j<BUFSIZE;++j)
    for(int k=0;k<BUFSIZE;++k)
    out[k]+=in1[i]*in2[j];

    return 0;
    }

  2. saghul Says:

    Nice benchmark! BTW I don’t absolutely like Go’s syntax, those braces, … and we’ve got Python, Ruby and lots of interesnting languages. Why would we want another?

  3. stenyak.com » Blog Archive » Google’s “go” simple & stupid benchmark (2nd round: memspeed) Says:

    […] Thanks to Juanval for the suggestion. […]

  4. Joe Gester Says:

    You aren’t benchmarking real go code here. You’re benchmarking the terminal IO code and terminal system. Systems programming doesn’t do much terminal IO.

  5. trantaloid Says:

    Joe Gester, cant you fucking read? which part of “1st round: I/O” didnt you understand?

    nice test btw

  6. Processor Benchmark Says:

    Sweet…. This is what I’m looking for

Leave a Reply