Gob is much more preferable when communicating between Go programs. However, gob is currently only supported in Go and, well, C , so always use this when you are sure that no program is written in any other programming language that will try to decode the values.
When it comes to performance, at least on my machine, Gob outperformed JSON with a long shot. test file (put it in a folder under your GOPATH)
$ go test -bench=.
testing: warning: no tests to run
BenchmarkGobEncoding-4 1000000 1172 ns/op
BenchmarkJSONEncoding-4 500000 2322 ns/op
BenchmarkGobDecoding-4 5000000 486 ns/op
BenchmarkJSONDecoding-4 500000 3228 ns/op
PASS
ok testencoding 6.814s
source
share