goraft/raft — pull request #151 by xiangli-cmu (2014-01-11 12:26:06+00:00)
Title: Refactor proto

switch to use gogoprotobuf generated codes.
Gogoprobuf will generate helper codes that do not use reflection.
Performance improve about 50%.

Before using gogoprotobuf
BenchmarkAppendEntriesRequestEncoding	1000	1806812 ns/op	74.17 MB/s
BenchmarkAppendEntriesRequestDecoding	1000	2217673 ns/op	60.43 MB/s
BenchmarkAppendEntriesResponseEncoding	1000000	1424 ns/op	5.62 MB/s
BenchmarkAppendEntriesResponseDecoding	1000000	3434 ns/op	2.33 MB/s

After using gogoprotobuf
BenchmarkAppendEntriesRequestEncoding	2000	1084766 ns/op	123.54 MB/s
BenchmarkAppendEntriesRequestDecoding	1000	1715724 ns/op	78.11 MB/s
BenchmarkAppendEntriesResponseEncoding	1000000	1450 ns/op	5.52 MB/s
BenchmarkAppendEntriesResponseDecoding	500000	3370 ns/op	2.37 MB/s

There are still some improving space. I am working on this.