LoginSignup
4
1

More than 5 years have passed since last update.

2017年版のGo msgpackライブラリベンチマーク

Posted at

Goのmsgpackのライブラリ比較として上記の記事があるのですが、 https://github.com/vmihailenco/msgpack のREADMEを見てるとそんなに遅くないっぽいので、当時からどのくらい改善されてるのか、現時点での比較を取ってみました。
(書いた後に気づいたんですが、別の方もコメントに同様の結果を投稿されてますね)

コードは上記の記事そのまま実行しています。

結果

前回 (2014)

$ go test -bench .
testing: warning: no tests to run
PASS
BenchmarkCodecEncode     1000000              1970 ns/op
BenchmarkCodecDecode     1000000              2543 ns/op
BenchmarkMsgpackEncode    500000              5274 ns/op
BenchmarkMsgpackDecode    500000              6793 ns/op
ok      _/Users/yoshihisa/junk/msgpack  10.761s

現在 (2017)

$ go version
go version go1.7.3 darwin/amd64

$ go test -bench .
testing: warning: no tests to run
BenchmarkCodecEncode-4           1000000              1937 ns/op
BenchmarkCodecDecode-4            300000              5637 ns/op
BenchmarkMsgpackEncode-4         1000000              1684 ns/op
BenchmarkMsgpackDecode-4          500000              3077 ns/op
PASS
ok      github.com/daichirata/playground/msgpackbench   6.999s

なんと、本当に今はgithub.com/vmihailenco/msgpackの方が早いんですね。もちろん機能差や、色々なワークロードを試しているわけではないので一概には言えないですが、github.com/ugorji/go/codecよりはgithub.com/vmihailenco/msgpackの方がGoっぽいAPIで個人的には好きなので、今であれば選択肢として検討しても良さそうかなと思います。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1