a protobuf compiler for golang
- Go 1.1 or higher http://golang.org/
- Protobuf 2.4 or higher http://code.google.com/p/protobuf/
cd src
make
sudo make install
run these in shell
cd example
make
bin/main
extensions
Serialize/Parse a simple message
message Test {
message Sub {
required int32 f1 = 1;
required int32 f2 = 2;
optional int32 f3 = 3;
}
required int32 f1 = 1;
required int64 f2 = 2;
optional string f3 = 3;
optional bytes f4 = 4;
optional Sub f5 = 5;
repeated int32 f6 = 6;
}
Benchmark | gopbuf | goprotobuf | protobuf(cpp) | protobuf(cpp +O3) |
---|---|---|---|---|
Serialize(1000000) | 0.483s | 1.364s | 0.862s | 0.141s |
Parse(1000000) | 1.393s | 2.165s | 0.696s | 0.231s |