1.删除msgp序列化方式

2.优化临时内存池减少GC
This commit is contained in:
boyce
2020-07-11 15:44:25 +08:00
parent 688d2d0bb4
commit 7b0072bbff
8 changed files with 42 additions and 570 deletions

View File

@@ -17,6 +17,7 @@ type JsonRpcRequestData struct {
InParam []byte
}
type JsonRpcResponseData struct {
//head
Seq uint64 // sequence number chosen by client
@@ -27,7 +28,6 @@ type JsonRpcResponseData struct {
}
var rpcJsonResponeDataPool sync.Pool
var rpcJsonRequestDataPool sync.Pool
@@ -51,13 +51,14 @@ func (slf *JsonProcessor) Unmarshal(data []byte, v interface{}) error{
return json.Unmarshal(data,v)
}
func (slf *JsonProcessor) MakeRpcRequest(seq uint64,serviceMethod string,noReply bool,inParam []byte) IRpcRequestData{
jsonRpcRequestData := rpcJsonRequestDataPool.Get().(*JsonRpcRequestData)
jsonRpcRequestData.Seq = seq
jsonRpcRequestData.ServiceMethod = serviceMethod
jsonRpcRequestData.NoReply = noReply
jsonRpcRequestData.InParam = inParam
return jsonRpcRequestData
}