Some rudimentary protocol benchmarks for go.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package msgpack
|
|
|
|
|
|
import (
|
|
|
"github.com/vmihailenco/msgpack"
|
|
|
)
|
|
|
|
|
|
type MsgpackTest struct {
|
|
|
Version float32
|
|
|
Method string
|
|
|
Params []string
|
|
|
}
|
|
|
|
|
|
func MsgpackPack() {
|
|
|
msgpack.Marshal(&MsgpackTest{
|
|
|
Version: 2.0,
|
|
|
Method: "echo",
|
|
|
Params: []string{
|
|
|
"some",
|
|
|
"params",
|
|
|
"here",
|
|
|
},
|
|
|
})
|
|
|
}
|
|
|
|
|
|
func MsgpackUnpack() {
|
|
|
var test MsgpackTest
|
|
|
msgpack.Unmarshal([]byte(`{"Version":2.0,"Method":"echo","params":["some","params","here"]}`), &test)
|
|
|
}
|