Categorygithub.com/alexshtin/proto-bench
repositorypackage
0.0.0-20201001050211-a25c50f6316c
Repository: https://github.com/alexshtin/proto-bench.git
Documentation: pkg.go.dev

# README

Benchmarks of Go Protobuf libraries

This is a test suite for benchmarking various Go Protobuf libraries.

Libraries

Running the benchmarks

make all
make test

To update the table in the README:

./stats.sh

Data

The data being serialized is the following structure with randomly generated values:

message Go {
  string name = 1;
  int64 birthDay = 2;
  string phone = 3;
  int32 siblings = 4;
  bool spouse = 5;
  double money = 6;
  Type type = 7;
  oneof values {
    string value_s = 8;
    int32 value_i = 9;
    double value_d = 10;
  }
}

enum Type {
  TYPE_UNSPECIFIED = 0;
  TYPE_R = 1;
  TYPE_S = 2;
}

Results

benchmarkitertime/iterbytes/opallocs/optt.sectt.kbns/alloc
Benchmark_GogoV1_JSON_Marshal-45570421345 ns/op15645611.198684.68
Benchmark_GogoV1_JSON_Unmarshal-45280221064 ns/op15646031.118234.58
Benchmark_GogoV1_Proto_Marshal-41481065861 ns/op60641.28890113.45
Benchmark_GogoV1_Proto_Unmarshal-42412230568 ns/op60481.371449711.83
Benchmark_GoV1_JSON_Marshal-42206656542 ns/op15410031.4433986.52
Benchmark_GoV1_JSON_Unmarshal-47005616583 ns/op15441041.1610784.04
Benchmark_GoV1old_JSON_Marshal-46918917325 ns/op15440161.2010654.31
Benchmark_GoV1old_JSON_Unmarshal-45864021309 ns/op15446801.259034.55
Benchmark_GoV1old_Proto_Marshal-410000001319 ns/op60721.32601018.32
Benchmark_GoV1old_Proto_Unmarshal-414087161117 ns/op601601.5784666.98
Benchmark_GoV1_Proto_Marshal-410000001430 ns/op60641.43601022.34
Benchmark_GoV1_Proto_Unmarshal-413051861023 ns/op601761.3478445.81
Benchmark_GoV2_JSON_Marshal-41868245441 ns/op1547611.0228777.15
Benchmark_GoV2_JSON_Unmarshal-42138205817 ns/op1547411.2432927.85
Benchmark_GoV2_Proto_Marshal-49460301231 ns/op60641.16568519.23
Benchmark_GoV2_Proto_Unmarshal-410000001016 ns/op601761.0260105.77

Totals:

benchmarkitertime/iterbytes/opallocs/optt.sectt.kbns/alloc
Benchmark_GogoV1_Proto_-438932951429 ns/op1201125.564679712.76
Benchmark_GoV2_Proto_-419460302247 ns/op1202404.37233919.36
Benchmark_GoV1old_Proto_-424087162436 ns/op1202325.872895210.50
Benchmark_GoV1_Proto_-423051862453 ns/op1202405.652770810.22
Benchmark_GoV2_JSON_-440064411258 ns/op30815024.51123397.50
Benchmark_GoV1_JSON_-429072123125 ns/op30851076.7289544.53
Benchmark_GoV1old_JSON_-412782938634 ns/op30886964.9439374.44
Benchmark_GogoV1_JSON_-410850642409 ns/op31291644.6033854.63