Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brettlangdon/proto-bench
Some rudimentary protocol benchmarks for go.
https://github.com/brettlangdon/proto-bench
Last synced: about 1 month ago
JSON representation
Some rudimentary protocol benchmarks for go.
- Host: GitHub
- URL: https://github.com/brettlangdon/proto-bench
- Owner: brettlangdon
- Created: 2014-04-22T18:49:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-22T18:49:30.000Z (over 10 years ago)
- Last Synced: 2024-10-12T22:44:55.545Z (3 months ago)
- Language: Go
- Size: 105 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Some redimentary benchmarks for performance + size of different over the wire protocols.
```bash
$ git clone git://github.com/brettlangdon/proto-bench
$ cd ./proto-bench
$ go run main.go
Struct Size: 48
BSON Size: 24
BSON Length: 90
Zversion@methodechoparams+0some1params2here
JSON Size: 24
JSON Length: 63
{"Version":2,"Method":"echo","Params":["some","params","here"]}
MSGPACK Size: 24
MSGPACK Length: 51
��Version�@�Method�echo�Params��some�params�here
$ go test -bench=. -benchmem ./bson ./json ./msgpack
PASS
BenchmarkBsonPack 500000 3950 ns/op 621 B/op 23 allocs/op
BenchmarkBsonUnpack 1000000 1206 ns/op 261 B/op 6 allocs/op
ok github.com/brettlangdon/proto-bench/bson 3.303s
PASS
BenchmarkJsonPack 1000000 1723 ns/op 287 B/op 4 allocs/op
BenchmarkJsonUnpack 500000 5349 ns/op 576 B/op 15 allocs/op
ok github.com/brettlangdon/proto-bench/json 4.472s
PASS
BenchmarkMsgpackPack 1000000 1585 ns/op 286 B/op 6 allocs/op
BenchmarkMsgpackUnpack 1000000 1440 ns/op 390 B/op 7 allocs/op
ok github.com/brettlangdon/proto-bench/msgpack 3.064s
```