咖啡伴侶

          呆在上海
          posts - 163, comments - 156, trackbacks - 0, articles - 2

          導航

          公告

          呆在上海 

          Java,Flex,Android,SVG等技術的 圖形UI

          Email:leooath@gmail.com

          QQ:35339893


          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          go對象序列化和反序列化

          Posted on 2013-09-29 09:52 oathleo 閱讀(3071) 評論(0)  編輯  收藏 所屬分類: Golang
          模擬測試1,000, 000條數據 每條10個字節  也就是10M不到的 數據(高度結構化的數據)
          過程
          1.對象序列化為 byte
          2.byte反序為對象
          3.gzip壓縮byte

          測試語言go
          測試方案: raw byte,json ,bson, msgpack (protostuff需要先做對象配置文件,比較麻煩,通常認為和msgpack性能相當 )
          結果:msgpack 勝出


          大小
          gzip壓縮后大小
          對象到byte耗時
          byte到對象耗時
          raw 10000000
          6573252(65%) 未測試
          未測試
          json
          47515988 7919511 (17%) 3248ms 5280ms
          bson
          49888910 9506965 (19%)
          3863ms 6235ms
          msgpack
          29934223 7448484 2046ms 3113ms


          raw data: 1000000
          raw data gzip compress: 6573252 //gzip壓縮后大小

          start: 1000000
          Marshal cost: 3248  //json 序列化耗時
          json string: 47515988 
          json byte: 47515988  //二進制數組大小
          Unmarshal cost: 5280  //json 反序列化耗時
          test data: {1 100 0.9405091}
          json gzip compress: 7919511 //gzip壓縮后大小

          start
          Marshal cost: 3863
          bson byte: 49888910
          Unmarshal cost: 6235
          test data: {1 100 0.9405091}
          bson gzip compress: 9506965


          start: 1000000
          Marshal cost: 2046
          msgpack: 29934223
          Unmarshal cost: 3113
          test data: {1 100 0.9405091}
          msgpack gzip compress: 7448484
          主站蜘蛛池模板: 安塞县| 酉阳| 德阳市| 宿州市| 阿合奇县| 宿迁市| 玛沁县| 崇左市| 西贡区| 浠水县| 阿图什市| 清苑县| 延庆县| 揭西县| 台湾省| 方山县| 苏尼特左旗| 江都市| 当涂县| 望都县| 南投市| 渭南市| 鹤峰县| 安图县| 芷江| 宾阳县| 上杭县| 乌恰县| 蓬溪县| 旅游| 治县。| 宕昌县| 鲁山县| 若尔盖县| 阳城县| 铜陵市| 临沂市| 剑阁县| 庆城县| 同德县| 栾城县|