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
November 11th, 2009 at 19:02
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;
}
November 11th, 2009 at 21:29
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?
November 12th, 2009 at 09:31
[…] Thanks to Juanval for the suggestion. […]
November 12th, 2009 at 14:30
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.
December 15th, 2009 at 10:23
Joe Gester, cant you fucking read? which part of “1st round: I/O” didnt you understand?
nice test btw
March 5th, 2010 at 18:18
Sweet…. This is what I’m looking for