atemerev / skynet

Skynet 1M threads microbenchmark
MIT License
1.04k stars 122 forks source link

gofmt and other idiomatic fixes #8

Closed peterbourgon closed 8 years ago

peterbourgon commented 8 years ago

Just make it nicer Go code. Makes it a little bit faster, too, though it's likely just statistical noise.

$ go get github.com/peterbourgon/stats

$ cd $GOPATH/src/github.com/atemerev/skynet/go
$ go build 
$ for i in (seq 1 100) ; echo -n '.' ; ./go | awk '{print $4}' >> ~/orig.txt ; end ; echo
....................................................................................................
$ cat ~/orig.txt | stats
min 651.0000
max 1142.0000
sum 86212.0000
mean 862.1200
median 862.1200
modes [716 874 893 920 946 1008]
stdev 108.6932

$ cd $GOPATH/src/github.com/peterbourgon/skynet/go
$ go build
$ for i in (seq 1 100) ; echo -n '.' ; ./go | awk '{print $4}' >> ~/fork.txt ; end ; echo
....................................................................................................
$ cat ~/fork.txt | stats
min 649.0000
max 1110.0000
sum 83548.0000
mean 835.4800
median 835.4800
modes [768 999]
stdev 99.1190
zach-klippenstein commented 8 years ago

It's tricky to parse what the non-gofmt changes were, could you spilt this into 2 commits? (gofmt then the other changes)