-
-
Notifications
You must be signed in to change notification settings - Fork 53
Benchmark
Pascal S. de Kloe edited this page Jan 26, 2017
·
15 revisions
Colfer's own benchmarks use the following 4 data samples.
var testData = []*Colfer{
{Key: 1234567890, Host: "db003lz12", Port: 389, Size: 452, Hash: 0x488b5c2428488918, Ratio: 0.99, Route: true},
{Key: 1234567891, Host: "localhost", Port: 22, Size: 4096, Hash: 0x243048899c24c824, Ratio: 0.20, Route: false},
{Key: 1234567892, Host: "kdc.local", Port: 88, Size: 1984, Hash: 0x000048891c24485c, Ratio: 0.06, Route: false},
{Key: 1234567893, Host: "vhost8.dmz.example.com", Port: 27017, Size: 59741, Hash: 0x5c2408488b9c2489, Ratio: 0.0, Route: true},
}
The following tests were executed on a Intel i5-2520M (from Q1 2011) with OpenBSD 6.0.
BENCH Colfer 10000000 marshals avg 35ns
BENCH Colfer 10000000 umarshals avg 112ns
BENCH FlatBuffers 10000000 marshals avg 1091ns
BENCH FlatBuffers 10000000 unmarshals avg 215ns
BenchmarkMarshal/colfer-2 30000000 134 ns/op 48 B/op 1 allocs/op
BenchmarkMarshal/protobuf-2 30000000 153 ns/op 52 B/op 1 allocs/op
BenchmarkMarshal/flatbuf-2 3000000 1360 ns/op 472 B/op 12 allocs/op
BenchmarkUnmarshal/colfer-2 20000000 224 ns/op 84 B/op 2 allocs/op
BenchmarkUnmarshal/protobuf-2 20000000 235 ns/op 84 B/op
2 allocs/op
BenchmarkUnmarshal/flatbuf-2 20000000 296 ns/op 84 B/op
2 allocs/op
BenchmarkMarshalReuse/colfer-2 100000000 55.2 ns/op 0 B/op
0 allocs/op
BenchmarkMarshalReuse/protobuf-2 100000000 75.8 ns/op 0 B/op
0 allocs/op
BenchmarkMarshalReuse/flatbuf-2 10000000 450 ns/op 0 B/op
0 allocs/op
BenchmarkUnmarshalReuse/colfer-2 50000000 132 ns/op 20 B/op
1 allocs/op
BenchmarkUnmarshalReuse/protobuf-2 20000000 178 ns/op 20 B/op
1 allocs/op
BenchmarkUnmarshalReuse/flatbuf-2 20000000 184 ns/op 20 B/op
1 allocs/op
20M marshals avg 79ns
20M marshals with buffer reuse avg 53ns
20M unmarshals avg 86ns
- @alecthomas's Go serialization benchmarks GitHub
- @eishay's JVM serializers GitHub wiki