Json性能对比

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/liu425151047/article/details/100586361

说明:一条数据解析1,000,000次,循环10遍

Gson依赖版本2.8.5,Jackson依赖版本2.9.9.2

短数据

"{\"createDate\":1498616533082,\"id\":1,\"name\":\"aa\",\"price\":22.1,\"publish\":false}"

 

Gson

Jackson

序列化

Cost 2222 ms.
Cost 1798 ms.
Cost 1169 ms.
Cost 1166 ms.
Cost 1197 ms.
Cost 1167 ms.
Cost 1173 ms.
Cost 1160 ms.
Cost 1162 ms.
Cost 1172 ms.

Cost 562 ms.
Cost 414 ms.
Cost 391 ms.
Cost 311 ms.
Cost 403 ms.
Cost 328 ms.
Cost 312 ms.
Cost 306 ms.
Cost 310 ms.
Cost 312 ms.

反序列化

Cost 6270 ms.
Cost 6063 ms.
Cost 6046 ms.
Cost 6100 ms.
Cost 6195 ms.
Cost 6081 ms.
Cost 6044 ms.
Cost 6071 ms.
Cost 6139 ms.
Cost 6080 ms.

Cost 547 ms.
Cost 452 ms.
Cost 444 ms.
Cost 449 ms.
Cost 455 ms.
Cost 484 ms.
Cost 461 ms.
Cost 463 ms.
Cost 475 ms.
Cost 459 ms.

模拟线上数据:

{
  "search_name": [],
  "orignal_id": "youku_XNDA4Nzk5Nzk4MA==",
  "gid": "video.video/com.youku.short.phone/youku_XNDA4Nzk5Nzk4MA==",
  "is_short": true,
  "dup_name": "表情包无上限、语音自带进度条,哪个微信功能你最想要?",
  "orignal_score": 3.474689483642578,
  "category_name": "科技",
  "create_time": 1551801600,
  "duration": 191,
  "title": "表情包无上限、语音自带进度条,哪个微信功能你最想要?"
}

 

Gson

Jackson

序列化

Cost 4036 ms.
Cost 2531 ms.
Cost 2525 ms.
Cost 2482 ms.
Cost 2506 ms.
Cost 2506 ms.
Cost 2486 ms.
Cost 2480 ms.
Cost 2483 ms.
Cost 2499 ms.

Cost 982 ms.
Cost 792 ms.
Cost 803 ms.
Cost 714 ms.
Cost 703 ms.
Cost 701 ms.
Cost 715 ms.
Cost 719 ms.
Cost 723 ms.
Cost 722 ms.

反序列化

Cost 7770 ms.
Cost 7424 ms.
Cost 7611 ms.
Cost 7510 ms.
Cost 7431 ms.
Cost 7628 ms.
Cost 7482 ms.
Cost 7583 ms.
Cost 7456 ms.
Cost 7621 ms.

Cost 1162 ms.
Cost 1084 ms.
Cost 1080 ms.
Cost 1158 ms.
Cost 1139 ms.
Cost 1147 ms.
Cost 1088 ms.
Cost 1075 ms.
Cost 1083 ms.
Cost 1076 ms.

文章创建于: 2019-09-06 20:47:59
展开阅读全文

没有更多推荐了,返回首页