Python 2.6 JSON decoding performance

后端 未结 7 1309
春和景丽
春和景丽 2020-11-30 05:30

I\'m using the json module in Python 2.6 to load and decode JSON files. However I\'m currently getting slower than expected performance. I\'m using a test case

7条回答
  •  离开以前
    2020-11-30 05:54

    I was parsing the same file 10x. File size was 1,856,944 bytes.

    Python 2.6:

    yajl        serialize: 0.294  deserialize: 0.334  total: 0.627
    cjson       serialize: 0.494  deserialize: 0.276  total: 0.769
    simplejson  serialize: 0.554  deserialize: 0.268  total: 0.823
    stdlib json serialize: 3.917  deserialize: 17.508 total: 21.425
    

    Python 2.7:

    yajl        serialize: 0.289  deserialize: 0.312  total: 0.601
    cjson       serialize: 0.232  deserialize: 0.254  total: 0.486
    simplejson  serialize: 0.288  deserialize: 0.253  total: 0.540
    stdlib json serialize: 0.273  deserialize: 0.256  total: 0.528
    

    Not sure why numbers are disproportionate from your results. I guess, newer libraries?

提交回复
热议问题