为什么要分析gob序列化格式的性能
RPCHTTPRPCHTTPRPCJSONgob
测试方法
strring[]bytegolangencoding/gob
测试程序
下面是测试程序的源代码和用法:
import ( "encoding/gob" "io/ioutil" "os") type FileAll struct{ Name string Cxt []byte }func main(){ var fa1 FileAll var err error fa1.Name = os.Args[1] fa1.Cxt,err = ioutil.ReadFile( os.Args[1] ) if err != nil{ panic(err) } enc := gob.NewEncoder(os.Stdout) enc.Encode(fa1) }
gob1 输入文件 > 输出文件
测试结果
gobRPCCreateFile->WriteBytes->CloseFilegzip